diff --git a/proxmox-io/src/byte_buffer.rs b/proxmox-io/src/byte_buffer.rs index 5e944144..fbfbbbb6 100644 --- a/proxmox-io/src/byte_buffer.rs +++ b/proxmox-io/src/byte_buffer.rs @@ -207,8 +207,8 @@ mod test { fn test1() { let mut buffer = ByteBuffer::new(); let slice = buffer.get_free_mut_slice(); - for i in 0..slice.len() { - slice[i] = (i % 255) as u8; + for (i, value) in slice.iter_mut().enumerate() { + *value = (i % 255) as u8; } buffer.add_size(5); diff --git a/proxmox-io/src/sparse_copy.rs b/proxmox-io/src/sparse_copy.rs index 60c87eac..94035de0 100644 --- a/proxmox-io/src/sparse_copy.rs +++ b/proxmox-io/src/sparse_copy.rs @@ -161,19 +161,16 @@ mod test { fn test_sparse_copy() { // test sparse let mut test_data = Vec::new(); - for _ in 0..LEN / 2 { - test_data.push(1u8); - } - for _ in 0..LEN / 2 { - test_data.push(0u8); - } + test_data.resize(LEN / 2, 1u8); + test_data.resize(LEN, 0u8); + let mut test_data = Cursor::new(test_data); let mut result_data = Cursor::new(vec![0; LEN]); let result = sparse_copy(&mut test_data, &mut result_data).expect("error during sparse copy"); assert_eq!(result.written, LEN as u64); - assert_eq!(result.seeked_last, true); + assert!(result.seeked_last); for i in 0..LEN { if i < LEN / 2 { assert_eq!(result_data.get_ref()[i], 1); @@ -189,7 +186,7 @@ mod test { let result = sparse_copy(&mut test_data, &mut result_data).expect("error during sparse copy"); assert_eq!(result.written, LEN as u64); - assert_eq!(result.seeked_last, false); + assert!(!result.seeked_last); for i in 0..LEN { assert_eq!(result_data.get_ref()[i], 1); } @@ -214,12 +211,8 @@ mod test { let mut fut = async { // test sparse let mut test_data = Vec::new(); - for _ in 0..LEN / 2 { - test_data.push(1u8); - } - for _ in 0..LEN / 2 { - test_data.push(0u8); - } + test_data.resize(LEN / 2, 1u8); + test_data.resize(LEN, 0u8); let mut test_data = Cursor::new(test_data); let mut result_data = Cursor::new(vec![0; LEN]); @@ -228,7 +221,7 @@ mod test { .expect("error during sparse copy"); assert_eq!(result.written, LEN as u64); - assert_eq!(result.seeked_last, true); + assert!(result.seeked_last); for i in 0..LEN { if i < LEN / 2 { assert_eq!(result_data.get_ref()[i], 1); @@ -246,7 +239,7 @@ mod test { .expect("error during sparse copy"); assert_eq!(result.written, LEN as u64); - assert_eq!(result.seeked_last, false); + assert!(!result.seeked_last); for i in 0..LEN { assert_eq!(result_data.get_ref()[i], 1); } diff --git a/proxmox-schema/src/de.rs b/proxmox-schema/src/de.rs index c1a8ae98..cb9a53e2 100644 --- a/proxmox-schema/src/de.rs +++ b/proxmox-schema/src/de.rs @@ -234,6 +234,7 @@ where } #[test] +#[allow(clippy::blacklisted_name)] fn test_extraction() { use serde::Deserialize; diff --git a/proxmox-time/src/test.rs b/proxmox-time/src/test.rs index 069433a5..d7e86c30 100644 --- a/proxmox-time/src/test.rs +++ b/proxmox-time/src/test.rs @@ -16,6 +16,7 @@ const fn make_test_time(mday: i32, hour: i32, min: i32) -> i64 { } #[test] +#[allow(clippy::identity_op)] fn test_compute_next_event() -> Result<(), Error> { let test_value = |v: &'static str, last: i64, expect: i64| -> Result { let event: CalendarEvent = match format!("{} UTC", v).parse() {