Fix clippy lint 2023/10/07 (#495)

Fix the most recent batch of clippy lints

- [x] no changelog update needed
This commit is contained in:
Gwilym Inzani 2023-10-07 20:54:52 +01:00 committed by GitHub
commit 3f225a2b59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 19 deletions

View file

@ -31,7 +31,7 @@ use core::{
alloc::Allocator,
borrow::Borrow,
fmt::Debug,
hash::{BuildHasher, BuildHasherDefault, Hash, Hasher},
hash::{BuildHasher, BuildHasherDefault, Hash},
iter::FromIterator,
num::Wrapping,
ops::Index,
@ -470,9 +470,7 @@ where
K: Borrow<Q>,
Q: Hash + ?Sized,
{
let mut hasher = self.hasher.build_hasher();
key.hash(&mut hasher);
let result = hasher.finish();
let result = self.hasher.hash_one(key);
// we want to allow truncation here since we're reducing 64 bits to 32
#[allow(clippy::cast_possible_truncation)]
@ -949,7 +947,7 @@ impl core::ops::Add<i32> for HashType {
#[cfg(test)]
mod test {
use core::cell::RefCell;
use core::{cell::RefCell, hash::Hasher};
use alloc::vec::Vec;

View file

@ -350,20 +350,6 @@ impl VBlank {
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test_case]
fn test_interrupt_table_length(_gba: &mut crate::Gba) {
assert_eq!(
unsafe { INTERRUPT_TABLE.len() },
Interrupt::Gamepak as usize + 1,
"interrupt table should be able to store gamepak interrupt"
);
}
}
#[must_use]
/// The behaviour of this function is undefined in the sense that it will output
/// some information in some way that can be interpreted in a way to give some
@ -384,3 +370,17 @@ pub fn profiler(timer: &mut crate::timer::Timer, period: u16) -> InterruptHandle
})
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test_case]
fn test_interrupt_table_length(_gba: &mut crate::Gba) {
assert_eq!(
unsafe { INTERRUPT_TABLE.len() },
Interrupt::Gamepak as usize + 1,
"interrupt table should be able to store gamepak interrupt"
);
}
}