Skip to content

Commit 3f225a2

Browse files
authored
Fix clippy lint 2023/10/07 (#495)
Fix the most recent batch of clippy lints - [x] no changelog update needed
2 parents 53685b0 + 534a357 commit 3f225a2

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

agb-hashmap/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use core::{
3131
alloc::Allocator,
3232
borrow::Borrow,
3333
fmt::Debug,
34-
hash::{BuildHasher, BuildHasherDefault, Hash, Hasher},
34+
hash::{BuildHasher, BuildHasherDefault, Hash},
3535
iter::FromIterator,
3636
num::Wrapping,
3737
ops::Index,
@@ -470,9 +470,7 @@ where
470470
K: Borrow<Q>,
471471
Q: Hash + ?Sized,
472472
{
473-
let mut hasher = self.hasher.build_hasher();
474-
key.hash(&mut hasher);
475-
let result = hasher.finish();
473+
let result = self.hasher.hash_one(key);
476474

477475
// we want to allow truncation here since we're reducing 64 bits to 32
478476
#[allow(clippy::cast_possible_truncation)]
@@ -949,7 +947,7 @@ impl core::ops::Add<i32> for HashType {
949947

950948
#[cfg(test)]
951949
mod test {
952-
use core::cell::RefCell;
950+
use core::{cell::RefCell, hash::Hasher};
953951

954952
use alloc::vec::Vec;
955953

agb/src/interrupt.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,20 +350,6 @@ impl VBlank {
350350
}
351351
}
352352

353-
#[cfg(test)]
354-
mod tests {
355-
use super::*;
356-
357-
#[test_case]
358-
fn test_interrupt_table_length(_gba: &mut crate::Gba) {
359-
assert_eq!(
360-
unsafe { INTERRUPT_TABLE.len() },
361-
Interrupt::Gamepak as usize + 1,
362-
"interrupt table should be able to store gamepak interrupt"
363-
);
364-
}
365-
}
366-
367353
#[must_use]
368354
/// The behaviour of this function is undefined in the sense that it will output
369355
/// 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
384370
})
385371
}
386372
}
373+
374+
#[cfg(test)]
375+
mod tests {
376+
use super::*;
377+
378+
#[test_case]
379+
fn test_interrupt_table_length(_gba: &mut crate::Gba) {
380+
assert_eq!(
381+
unsafe { INTERRUPT_TABLE.len() },
382+
Interrupt::Gamepak as usize + 1,
383+
"interrupt table should be able to store gamepak interrupt"
384+
);
385+
}
386+
}

0 commit comments

Comments
 (0)