Add support for ASRock firmware flashing #158
Annotations
21 warnings
casting to the same type is unnecessary (`u32` -> `u32`):
src/text.rs#L230
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
|
deref on an immutable reference:
src/text.rs#L115
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
|
deref on an immutable reference:
src/null.rs#L100
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
|
method `default` can be confused for the standard trait method `std::default::Default::default`:
src/image/mod.rs#L78
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
|
casting to the same type is unnecessary (`usize` -> `usize`):
src/display.rs#L73
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
|
casting to the same type is unnecessary (`usize` -> `usize`):
src/display.rs#L71
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
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/mod.rs#L277
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/mod.rs:277:21
|
277 | / match ec_kind {
278 | | // Make sure EC is unlocked if running System76 EC
279 | | EcKind::System76(_, _) => match unsafe { ec::security_unlock() } {
280 | | Ok(()) => (),
... |
287 | | _ => (),
288 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
|
277 ~ if let EcKind::System76(_, _) = ec_kind { match unsafe { ec::security_unlock() } {
278 + Ok(()) => (),
279 + Err(err) => {
280 + println!("Failed to unlock firmware: {:?}", err);
281 + return Err(Error::DeviceError);
282 + }
283 + } }
|
|
variables can be used directly in the `format!` string:
src/app/pci.rs#L103
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"));
|
|
variables can be used directly in the `format!` string:
src/app/pci.rs#L99
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"));
|
|
casting to the same type is unnecessary (`usize` -> `usize`):
src/app/mapper.rs#L11
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
|
variables can be used directly in the `format!` string:
src/app/ec.rs#L750
warning: variables can be used directly in the `format!` string
--> src/app/ec.rs:750:41
|
750 | let status = shell(&format!(
| _________________________________________^
751 | | "{} {} {} flash",
752 | | FIRMWARENSH, FIRMWAREDIR, command
753 | | ))?;
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
|
variables can be used directly in the `format!` string:
src/app/ec.rs#L713
warning: variables can be used directly in the `format!` string
--> src/app/ec.rs:713:37
|
713 | let status = shell(&format!(
| _____________________________________^
714 | | "{} {} {} flash",
715 | | FIRMWARENSH, FIRMWAREDIR, command
716 | | ))?;
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/ec.rs#L228
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/ec.rs:228:9
|
228 | / match &self.ec {
229 | | EcKind::Pang(_pmc, _system_version) => {
230 | | return data.len() == 128 * 1024
231 | | && &data[0x50 ..= 0x05F] == b"ITE EC-V14.6 \0";
232 | | },
233 | | _ => (),
234 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
|
228 ~ if let EcKind::Pang(_pmc, _system_version) = &self.ec {
229 + return data.len() == 128 * 1024
230 + && &data[0x50 ..= 0x05F] == b"ITE EC-V14.6 \0";
231 + }
|
|
the loop variable `i` is used to index `ymd`:
src/app/ec.rs#L157
warning: the loop variable `i` is used to index `ymd`
--> src/app/ec.rs:157:26
|
157 | 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
|
157 | for (i, <item>) in ymd.iter_mut().enumerate() {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
the loop variable `i` is used to index `hms`:
src/app/ec.rs#L146
warning: the loop variable `i` is used to index `hms`
--> src/app/ec.rs:146:26
|
146 | 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
|
146 | for (i, <item>) in hms.iter_mut().enumerate() {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
you seem to be trying to use `match` for an equality check. Consider using `if`:
src/app/ec.rs#L63
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 + }
|
|
variables can be used directly in the `format!` string:
src/app/bios.rs#L541
warning: variables can be used directly in the `format!` string
--> src/app/bios.rs:541:23
|
541 | 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
|
541 - let cmd = format!("{} {} bios flash", FIRMWARENSH, FIRMWAREDIR);
541 + let cmd = format!("{FIRMWARENSH} {FIRMWAREDIR} bios flash");
|
|
variables can be used directly in the `format!` string:
src/app/bios.rs#L51
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"));
|
|
variables can be used directly in the `format!` string:
src/app/bios.rs#L40
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"));
|
|
lint
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
build
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|