Skip to content

Invalidate CMOS checksum after flashing #150

Invalidate CMOS checksum after flashing

Invalidate CMOS checksum after flashing #150

GitHub Actions / clippy succeeded Jun 7, 2023 in 0s

clippy

20 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 20
Note 0
Help 0

Versions

  • rustc 1.68.0-nightly (5ce39f42b 2023-01-20)
  • cargo 1.68.0-nightly (985d561f0 2023-01-20)
  • clippy 0.1.68 (5ce39f4 2023-01-20)

Annotations

Check warning on line 230 in src/text.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`u32` -> `u32`)

warning: casting to the same type is unnecessary (`u32` -> `u32`)
   --> src/text.rs:230:50
    |
230 |             self.display.blit(cx, cy, cw as u32, ch as u32);
    |                                                  ^^^^^^^^^ help: try: `ch`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 115 in src/text.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

deref on an immutable reference

warning: deref on an immutable reference
   --> src/text.rs:115:43
    |
115 |             Mode: unsafe { mem::transmute(&*mode.deref()) },
    |                                           ^^^^^^^^^^^^^^ help: if you would like to reborrow, try removing `&*`: `mode.deref()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref

Check warning on line 100 in src/null.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

deref on an immutable reference

warning: deref on an immutable reference
   --> src/null.rs:100:43
    |
100 |             Mode: unsafe { mem::transmute(&*mode.deref()) },
    |                                           ^^^^^^^^^^^^^^ help: if you would like to reborrow, try removing `&*`: `mode.deref()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
    = note: `#[warn(clippy::borrow_deref_ref)]` on by default

Check warning on line 80 in src/image/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

method `default` can be confused for the standard trait method `std::default::Default::default`

warning: method `default` can be confused for the standard trait method `std::default::Default::default`
  --> src/image/mod.rs:78:5
   |
78 | /     pub fn default() -> Self {
79 | |         Self::new(0, 0)
80 | |     }
   | |_____^
   |
   = help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
   = note: `#[warn(clippy::should_implement_trait)]` on by default

Check warning on line 73 in src/display.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`)
  --> src/display.rs:73:60
   |
73 |                 fast_set32(data_ptr.add(off2), color.data, off1 as usize);
   |                                                            ^^^^^^^^^^^^^ help: try: `off1`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 71 in src/display.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`)
  --> src/display.rs:71:21
   |
71 |                     off2 as usize * 4,
   |                     ^^^^^^^^^^^^^ help: try: `off2`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 103 in src/app/pci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
   --> src/app/pci.rs:103:20
    |
103 |         return Err(format!("pci_read func 0x{:x} is greater than 0x7", func));
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
103 -         return Err(format!("pci_read func 0x{:x} is greater than 0x7", func));
103 +         return Err(format!("pci_read func 0x{func:x} is greater than 0x7"));
    |

Check warning on line 99 in src/app/pci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
  --> src/app/pci.rs:99:20
   |
99 |         return Err(format!("pci_read dev 0x{:x} is greater than 0x1f", dev));
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
   |
99 -         return Err(format!("pci_read dev 0x{:x} is greater than 0x1f", dev));
99 +         return Err(format!("pci_read dev 0x{dev:x} is greater than 0x1f"));
   |

Check warning on line 11 in src/app/mapper.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`)
  --> src/app/mapper.rs:11:27
   |
11 |         Ok(VirtualAddress(address.0 as usize))
   |                           ^^^^^^^^^^^^^^^^^^ help: try: `address.0`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
   = note: `#[warn(clippy::unnecessary_cast)]` on by default

Check warning on line 768 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
   --> src/app/ec.rs:765:41
    |
765 |                       let status = shell(&format!(
    |  _________________________________________^
766 | |                         "{} {} {} flash",
767 | |                         FIRMWARENSH, FIRMWAREDIR, command
768 | |                     ))?;
    | |_____________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check warning on line 731 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
   --> src/app/ec.rs:728:37
    |
728 |                   let status = shell(&format!(
    |  _____________________________________^
729 | |                     "{} {} {} flash",
730 | |                     FIRMWARENSH, FIRMWAREDIR, command
731 | |                 ))?;
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check warning on line 706 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/app/ec.rs:695:13
    |
695 | /             match &self.ec {
696 | |                 // Make sure EC is unlocked if running System76 EC
697 | |                 EcKind::System76(_, _) => match unsafe { security_unlock() } {
698 | |                     Ok(()) => (),
...   |
705 | |                 _ => (),
706 | |             }
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
695 ~             if let EcKind::System76(_, _) = &self.ec { match unsafe { security_unlock() } {
696 +                 Ok(()) => (),
697 +                 Err(err) => {
698 +                     println!("{} Failed to unlock: {:?}", self.name(), err);
699 +                     return Err(Error::DeviceError);
700 +                 }
701 +             } }
    |

Check warning on line 233 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/app/ec.rs:227:9
    |
227 | /         match &self.ec {
228 | |             EcKind::Pang12(_pmc) => {
229 | |                 return data.len() == 128 * 1024
230 | |                     && &data[0x50 ..= 0x05F] == b"ITE EC-V14.6   \0";
231 | |             },
232 | |             _ => (),
233 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
227 ~         if let EcKind::Pang12(_pmc) = &self.ec {
228 +             return data.len() == 128 * 1024
229 +                 && &data[0x50 ..= 0x05F] == b"ITE EC-V14.6   \0";
230 +         }
    |

Check warning on line 156 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `i` is used to index `ymd`

warning: the loop variable `i` is used to index `ymd`
   --> src/app/ec.rs:156:26
    |
156 |                 for i in 0..ymd.len() {
    |                          ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
    |
156 |                 for (i, <item>) in ymd.iter_mut().enumerate() {
    |                     ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 145 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `i` is used to index `hms`

warning: the loop variable `i` is used to index `hms`
   --> src/app/ec.rs:145:26
    |
145 |                 for i in 0..hms.len() {
    |                          ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
    = note: `#[warn(clippy::needless_range_loop)]` on by default
help: consider using an iterator
    |
145 |                 for (i, <item>) in hms.iter_mut().enumerate() {
    |                     ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 75 in src/app/ec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for an equality check. Consider using `if`

warning: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> src/app/ec.rs:63:17
   |
63 | /                 match table.header.kind {
64 | |                     1 => {
65 | |                         if let Ok(info) = dmi::SystemInfo::from_bytes(&table.data) {
66 | |                             let index = info.version;
...  |
74 | |                     _ => {}
75 | |                 }
   | |_________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default
help: try this
   |
63 ~                 if table.header.kind == 1 {
64 +                     if let Ok(info) = dmi::SystemInfo::from_bytes(&table.data) {
65 +                         let index = info.version;
66 +                         if index > 0 {
67 +                             if let Some(value) = table.strings.get((index - 1) as usize) {
68 +                                 system_version = value.trim().to_string();
69 +                             }
70 +                         }
71 +                     }
72 +                 }
   |

Check warning on line 538 in src/app/bios.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
   --> src/app/bios.rs:538:23
    |
538 |             let cmd = format!("{} {} bios flash", FIRMWARENSH, FIRMWAREDIR);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
538 -             let cmd = format!("{} {} bios flash", FIRMWARENSH, FIRMWAREDIR);
538 +             let cmd = format!("{FIRMWARENSH} {FIRMWAREDIR} bios flash");
    |

Check warning on line 51 in src/app/bios.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
  --> src/app/bios.rs:51:28
   |
51 |                 return Err(format!("new region {:#X}:{:#X} is invalid", base, limit));
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
   |
51 -                 return Err(format!("new region {:#X}:{:#X} is invalid", base, limit));
51 +                 return Err(format!("new region {base:#X}:{limit:#X} is invalid"));
   |

Check warning on line 40 in src/app/bios.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
  --> src/app/bios.rs:40:28
   |
40 |                 return Err(format!("old region {:#X}:{:#X} is invalid", base, limit));
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
   = note: `#[warn(clippy::uninlined_format_args)]` on by default
help: change this to
   |
40 -                 return Err(format!("old region {:#X}:{:#X} is invalid", base, limit));
40 +                 return Err(format!("old region {base:#X}:{limit:#X} is invalid"));
   |

Check warning on line 18 in src/app/cmos.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated function `read` is never used

warning: associated function `read` is never used
  --> src/app/cmos.rs:18:12
   |
18 |     pub fn read(&mut self, addr: u8) -> u8 {
   |            ^^^^
   |
   = note: `#[warn(dead_code)]` on by default