mirror of
https://codeberg.org/ral/rwedid.git
synced 2024-08-16 09:59:49 +02:00
Some clippy lints
This commit is contained in:
parent
acf5e58de0
commit
0de6c4d001
4 changed files with 7 additions and 1 deletions
3
.rustfmt.toml
Normal file
3
.rustfmt.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
edition = "2021"
|
||||||
|
max_width = 110
|
||||||
|
newline_style = "Unix"
|
|
@ -1,6 +1,7 @@
|
||||||
// Compute the checksum over the bytes of a block.
|
// Compute the checksum over the bytes of a block.
|
||||||
|
#[allow(clippy::cast_possible_truncation)]
|
||||||
pub fn checksum(bytes: &[u8]) -> u8 {
|
pub fn checksum(bytes: &[u8]) -> u8 {
|
||||||
bytes.iter().fold(0u32, |x, y| x + (*y as u32)) as u8
|
bytes.iter().fold(0u32, |x, y| x + u32::from(*y)) as u8
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the checksum
|
// Validate the checksum
|
||||||
|
|
|
@ -36,6 +36,7 @@ pub fn write_to_bus(
|
||||||
// Write 8 bytes at a time
|
// Write 8 bytes at a time
|
||||||
for (i, chunk) in data.chunks_exact(8).enumerate() {
|
for (i, chunk) in data.chunks_exact(8).enumerate() {
|
||||||
// Memory address
|
// Memory address
|
||||||
|
#[allow(clippy::cast_possible_truncation)]
|
||||||
let address = memory_address + (i as u8) * 8;
|
let address = memory_address + (i as u8) * 8;
|
||||||
let mut msgs = [
|
let mut msgs = [
|
||||||
// Address to write to
|
// Address to write to
|
||||||
|
|
|
@ -23,6 +23,7 @@ pub fn block_by_block_read(
|
||||||
// Read remaining blocks
|
// Read remaining blocks
|
||||||
match num_extensions {
|
match num_extensions {
|
||||||
0 => vec![],
|
0 => vec![],
|
||||||
|
#[allow(clippy::cast_possible_truncation)]
|
||||||
_ => read(BLOCK_SIZE as u8, num_extensions * BLOCK_SIZE)?,
|
_ => read(BLOCK_SIZE as u8, num_extensions * BLOCK_SIZE)?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue