Skip to content

Commit

Permalink
Fixed some clippy lints.
Browse files Browse the repository at this point in the history
  • Loading branch information
orium committed Sep 6, 2024
1 parent d409172 commit 799c9f1
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ fatal-warnings = []
std = []

[lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
correctness = "deny"
all = { level = "warn", priority = -2 }
pedantic = { level = "warn", priority = -2 }
correctness = { level = "deny", priority = -1 }

enum-glob-use = "allow"
if-not-else = "allow"
Expand Down
2 changes: 1 addition & 1 deletion src/list/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ fn test_partial_ord() {
let list_1_prime = list!["a"];
let list_2 = list!["b"];
let list_3 = list![0.0];
let list_4 = list![core::f32::NAN];
let list_4 = list![f32::NAN];

assert_eq!(list_1.partial_cmp(&list_1_prime), Some(Ordering::Equal));
assert_eq!(list_1.partial_cmp(&list_2), Some(Ordering::Less));
Expand Down
7 changes: 1 addition & 6 deletions src/map/hash_trie_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ mod node_utils {
use super::HashValue;
use core::hash::BuildHasher;
use core::hash::Hash;
use core::hash::Hasher;
use core::mem::size_of_val;

/// Returns the index of the array for the given hash on depth `depth`.
Expand All @@ -237,11 +236,7 @@ mod node_utils {
}

pub fn hash<T: ?Sized + Hash, H: BuildHasher>(v: &T, hasher_builder: &H) -> HashValue {
let mut hasher = hasher_builder.build_hasher();

v.hash(&mut hasher);

hasher.finish()
hasher_builder.hash_one(&v)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/map/red_black_tree_map/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ fn test_partial_ord() {
let map_1_prime = rbt_map!["a" => 0xa];
let map_2 = rbt_map!["b" => 0xb];
let map_3 = rbt_map![0 => 0.0];
let map_4 = rbt_map![0 => core::f32::NAN];
let map_4 = rbt_map![0 => f32::NAN];

assert_eq!(map_1.partial_cmp(&map_1_prime), Some(Ordering::Equal));
assert_eq!(map_1.partial_cmp(&map_2), Some(Ordering::Less));
Expand Down
2 changes: 1 addition & 1 deletion src/queue/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ fn test_partial_ord() {
let queue_1_prime = queue!["a"];
let queue_2 = queue!["b"];
let queue_3 = queue![0.0];
let queue_4 = queue![core::f32::NAN];
let queue_4 = queue![f32::NAN];

assert_eq!(queue_1.partial_cmp(&queue_1_prime), Some(Ordering::Equal));
assert_eq!(queue_1.partial_cmp(&queue_2), Some(Ordering::Less));
Expand Down
2 changes: 1 addition & 1 deletion src/set/hash_trie_set/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ where
T: Borrow<V>,
V: Hash + Eq,
{
self.map.get_key_value(v).map(|(k, _)| k)
self.map.get_key_value(v).map(|(k, ())| k)
}

#[must_use]
Expand Down
8 changes: 4 additions & 4 deletions src/set/red_black_tree_set/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ where
T: Borrow<V>,
V: Ord,
{
self.map.get_key_value(v).map(|(k, _)| k)
self.map.get_key_value(v).map(|(k, ())| k)
}

#[must_use]
Expand All @@ -182,12 +182,12 @@ where

#[must_use]
pub fn first(&self) -> Option<&T> {
self.map.first().map(|(k, _)| k)
self.map.first().map(|(k, ())| k)
}

#[must_use]
pub fn last(&self) -> Option<&T> {
self.map.last().map(|(k, _)| k)
self.map.last().map(|(k, ())| k)
}

#[must_use]
Expand Down Expand Up @@ -279,7 +279,7 @@ where
Q: Ord + ?Sized,
RB: RangeBounds<Q>,
{
self.map.range(range).map(|(k, _)| k)
self.map.range(range).map(|(k, ())| k)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stack/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ fn test_partial_ord() {
let stack_1_prime = stack!["a"];
let stack_2 = stack!["b"];
let stack_3 = stack![0.0];
let stack_4 = stack![core::f32::NAN];
let stack_4 = stack![f32::NAN];

assert_eq!(stack_1.partial_cmp(&stack_1_prime), Some(Ordering::Equal));
assert_eq!(stack_1.partial_cmp(&stack_2), Some(Ordering::Less));
Expand Down
2 changes: 1 addition & 1 deletion src/vector/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ fn test_partial_ord() {
let vector_1_prime = vector!["a"];
let vector_2 = vector!["b"];
let vector_3 = vector![0.0];
let vector_4 = vector![core::f32::NAN];
let vector_4 = vector![f32::NAN];

assert_eq!(vector_1.partial_cmp(&vector_1_prime), Some(Ordering::Equal));
assert_eq!(vector_1.partial_cmp(&vector_2), Some(Ordering::Less));
Expand Down

0 comments on commit 799c9f1

Please sign in to comment.