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;
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}",
address
);
@ -53,8 +53,8 @@ mod test {
v.push(i);
}
for i in 0..100 {
assert_eq!(v[i], i);
for (i, &e) in v.iter().enumerate() {
assert_eq!(e, i);
}
}
@ -66,7 +66,7 @@ mod test {
assert_eq!(*x, i);
let address = &*x as *const _ as usize;
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}",
address
);

View file

@ -26,9 +26,9 @@ impl<const N: usize> Bitarray<N> {
#[test_case]
fn write_and_read(_gba: &mut crate::Gba) {
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);
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");
}
@ -38,7 +38,7 @@ fn test_everything(_gba: &mut crate::Gba) {
let mut a: Bitarray<2> = Bitarray::new();
a.set(i, true);
for j in 0..64 {
let expected = if i == j { true } else { false };
let expected = i == j;
assert_eq!(
a.get(j).unwrap(),
expected,

View file

@ -195,7 +195,7 @@ mod test {
assert_eq!(content, 6, "expected data to have increased by one");
let address = ewram_ptr as usize;
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}",
address
);
@ -210,7 +210,7 @@ mod test {
let iwram_ptr = &mut IWRAM_EXPLICIT as *mut u32;
let address = iwram_ptr as usize;
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}",
address
);
@ -229,7 +229,7 @@ mod test {
let iwram_ptr = &mut IMPLICIT_STORAGE as *mut u32;
let address = iwram_ptr as usize;
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}",
address
);