resolve some clippy lints

This commit is contained in:
Corwin Kuiper 2021-10-17 22:08:33 +01:00
parent 6f804d884b
commit d22e46f7e3
3 changed files with 10 additions and 10 deletions

View file

@ -39,7 +39,7 @@ mod test {
let address = &*first_box as *const _ as usize; let address = &*first_box as *const _ as usize;
assert!( assert!(
address >= EWRAM_START && address < EWRAM_END, (EWRAM_START..EWRAM_END).contains(&address),
"ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}", "ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}",
address address
); );
@ -53,8 +53,8 @@ mod test {
v.push(i); v.push(i);
} }
for i in 0..100 { for (i, &e) in v.iter().enumerate() {
assert_eq!(v[i], i); assert_eq!(e, i);
} }
} }
@ -66,7 +66,7 @@ mod test {
assert_eq!(*x, i); assert_eq!(*x, i);
let address = &*x as *const _ as usize; let address = &*x as *const _ as usize;
assert!( assert!(
address >= EWRAM_START && address < EWRAM_END, (EWRAM_START..EWRAM_END).contains(&address),
"ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}", "ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}",
address address
); );

View file

@ -26,9 +26,9 @@ impl<const N: usize> Bitarray<N> {
#[test_case] #[test_case]
fn write_and_read(_gba: &mut crate::Gba) { fn write_and_read(_gba: &mut crate::Gba) {
let mut a: Bitarray<2> = Bitarray::new(); let mut a: Bitarray<2> = Bitarray::new();
assert_eq!(a.get(55).unwrap(), false, "expect unset values to be false"); assert_eq!(a.get(55), Some(false), "expect unset values to be false");
a.set(62, true); a.set(62, true);
assert_eq!(a.get(62).unwrap(), true, "expect set value to be true"); assert_eq!(a.get(62), Some(true), "expect set value to be true");
assert_eq!(a.get(120), None, "expect out of range to give None"); assert_eq!(a.get(120), None, "expect out of range to give None");
} }
@ -38,7 +38,7 @@ fn test_everything(_gba: &mut crate::Gba) {
let mut a: Bitarray<2> = Bitarray::new(); let mut a: Bitarray<2> = Bitarray::new();
a.set(i, true); a.set(i, true);
for j in 0..64 { for j in 0..64 {
let expected = if i == j { true } else { false }; let expected = i == j;
assert_eq!( assert_eq!(
a.get(j).unwrap(), a.get(j).unwrap(),
expected, expected,

View file

@ -195,7 +195,7 @@ mod test {
assert_eq!(content, 6, "expected data to have increased by one"); assert_eq!(content, 6, "expected data to have increased by one");
let address = ewram_ptr as usize; let address = ewram_ptr as usize;
assert!( assert!(
address >= 0x0200_0000 && address < 0x0204_0000, (0x0200_0000..0x0204_0000).contains(&address),
"ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}", "ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}",
address address
); );
@ -210,7 +210,7 @@ mod test {
let iwram_ptr = &mut IWRAM_EXPLICIT as *mut u32; let iwram_ptr = &mut IWRAM_EXPLICIT as *mut u32;
let address = iwram_ptr as usize; let address = iwram_ptr as usize;
assert!( assert!(
address >= 0x0300_0000 && address < 0x0300_8000, (0x0300_0000..0x0300_8000).contains(&address),
"iwram is located beween 0x0300_0000 and 0x0300_8000, but was actually found to be at {:#010X}", "iwram is located beween 0x0300_0000 and 0x0300_8000, but was actually found to be at {:#010X}",
address address
); );
@ -229,7 +229,7 @@ mod test {
let iwram_ptr = &mut IMPLICIT_STORAGE as *mut u32; let iwram_ptr = &mut IMPLICIT_STORAGE as *mut u32;
let address = iwram_ptr as usize; let address = iwram_ptr as usize;
assert!( assert!(
address >= 0x0200_0000 && address < 0x0204_0000, (0x0200_0000..0x0204_0000).contains(&address),
"implicit data storage is expected to be in ewram, which is between 0x0300_0000 and 0x0300_8000, but was actually found to be at {:#010X}", "implicit data storage is expected to be in ewram, which is between 0x0300_0000 and 0x0300_8000, but was actually found to be at {:#010X}",
address address
); );