Skip to content

Commit

Permalink
Fix clippy lint 2023/10/07 (#495)
Browse files Browse the repository at this point in the history
Fix the most recent batch of clippy lints

- [x] no changelog update needed
  • Loading branch information
gwilymk committed Oct 7, 2023
2 parents 53685b0 + 534a357 commit 3f225a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
8 changes: 3 additions & 5 deletions agb-hashmap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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;

Expand Down
28 changes: 14 additions & 14 deletions agb/src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
);
}
}

0 comments on commit 3f225a2

Please sign in to comment.