Skip to content

Commit fdd553b

Browse files
committed
cargo clippy
https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#byte_char_slices Also flip from le to be for more readable code Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent d7750de commit fdd553b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

framework_lib/src/ccgx/hid.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ fn decode_fw_info(buf: &[u8]) -> HidFirmwareInfo {
144144

145145
// TODO: Return Option?
146146
assert_eq!(info.report_id, ReportIdCmd::E0Read as u8);
147-
if info.signature != [b'C', b'Y'] {
147+
if info.signature != *b"CY" {
148148
println!("{:X?}", info);
149149
}
150-
assert_eq!(info.signature, [b'C', b'Y']);
150+
assert_eq!(info.signature, *b"CY");
151151

152152
info
153153
}
@@ -157,7 +157,7 @@ fn print_fw_info(info: &HidFirmwareInfo, verbose: bool) {
157157

158158
info!(" Signature: {:X?}", info.signature);
159159
// Something's totally off if the signature is invalid
160-
if info.signature != [b'C', b'Y'] {
160+
if info.signature != *b"CY" {
161161
error!("Firmware Signature is invalid.");
162162
return;
163163
}

framework_lib/src/ccgx/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const FW2_METADATA_ROW_CCG8: u32 = 0x3FF;
3131
const METADATA_OFFSET: usize = 0xC0; // TODO: Is this 0x40 on ADL?
3232
const CCG8_METADATA_OFFSET: usize = 0x80;
3333
const CCG3_METADATA_OFFSET: usize = 0x40;
34-
const METADATA_MAGIC: u16 = u16::from_le_bytes([b'Y', b'C']); // CY (Cypress)
35-
const CCG8_METADATA_MAGIC: u16 = u16::from_le_bytes([b'F', b'I']); // IF (Infineon)
34+
const METADATA_MAGIC: u16 = u16::from_be_bytes(*b"CY"); // CY (Cypress)
35+
const CCG8_METADATA_MAGIC: u16 = u16::from_be_bytes(*b"IF"); // IF (Infineon)
3636

3737
#[repr(C, packed)]
3838
#[derive(FromBytes, KnownLayout, Debug, Copy, Clone)]

0 commit comments

Comments
 (0)