Skip to content

Commit 4eec0b7

Browse files
authored
chore: suppress new clippy lints (TheAlgorithms#905)
1 parent dbef3d6 commit 4eec0b7

File tree

8 files changed

+13
-8
lines changed

8 files changed

+13
-8
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ manual_assert = { level = "allow", priority = 1 }
4444
manual_let_else = { level = "allow", priority = 1 }
4545
manual_string_new = { level = "allow", priority = 1 }
4646
many_single_char_names = { level = "allow", priority = 1 }
47-
match_on_vec_items = { level = "allow", priority = 1 }
4847
match_wildcard_for_single_variants = { level = "allow", priority = 1 }
4948
missing_errors_doc = { level = "allow", priority = 1 }
5049
missing_fields_in_debug = { level = "allow", priority = 1 }
@@ -69,6 +68,7 @@ used_underscore_binding = { level = "allow", priority = 1 }
6968
ref_option = { level = "allow", priority = 1 }
7069
unnecessary_semicolon = { level = "allow", priority = 1 }
7170
ignore_without_reason = { level = "allow", priority = 1 }
71+
needless_for_each = { level = "allow", priority = 1 }
7272
# restriction-lints:
7373
absolute_paths = { level = "allow", priority = 1 }
7474
arithmetic_side_effects = { level = "allow", priority = 1 }
@@ -169,3 +169,5 @@ doc_overindented_list_items = { level = "allow", priority = 1 }
169169
# complexity-lints
170170
precedence = { level = "allow", priority = 1 }
171171
manual_div_ceil = { level = "allow", priority = 1 }
172+
# perf-lints
173+
cloned_ref_to_slice_refs = { level = "allow", priority = 1 }

src/data_structures/avl_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<T: Ord> AVLTree<T> {
8585
}
8686

8787
/// Returns an iterator that visits the nodes in the tree in order.
88-
fn node_iter(&self) -> NodeIter<T> {
88+
fn node_iter(&self) -> NodeIter<'_, T> {
8989
let cap = self.root.as_ref().map_or(0, |n| n.height);
9090
let mut node_iter = NodeIter {
9191
stack: Vec::with_capacity(cap),
@@ -100,7 +100,7 @@ impl<T: Ord> AVLTree<T> {
100100
}
101101

102102
/// Returns an iterator that visits the values in the tree in ascending order.
103-
pub fn iter(&self) -> Iter<T> {
103+
pub fn iter(&self) -> Iter<'_, T> {
104104
Iter {
105105
node_iter: self.node_iter(),
106106
}

src/data_structures/binary_search_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<T> BinarySearchTreeIter<'_, T>
188188
where
189189
T: Ord,
190190
{
191-
pub fn new(tree: &BinarySearchTree<T>) -> BinarySearchTreeIter<T> {
191+
pub fn new(tree: &BinarySearchTree<T>) -> BinarySearchTreeIter<'_, T> {
192192
let mut iter = BinarySearchTreeIter { stack: vec![tree] };
193193
iter.stack_push_left();
194194
iter

src/data_structures/probabilistic/bloom_filter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub trait BloomFilter<Item: Hash> {
2121
/// When looking for an item, we hash its value and retrieve the boolean at index `hash(item) % CAPACITY`
2222
/// If it's `false` it's absolutely sure the item isn't present
2323
/// If it's `true` the item may be present, or maybe another one produces the same hash
24+
#[allow(dead_code)]
2425
#[derive(Debug)]
2526
struct BasicBloomFilter<const CAPACITY: usize> {
2627
vec: [bool; CAPACITY],

src/data_structures/treap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<T: Ord> Treap<T> {
8585
}
8686

8787
/// Returns an iterator that visits the nodes in the tree in order.
88-
fn node_iter(&self) -> NodeIter<T> {
88+
fn node_iter(&self) -> NodeIter<'_, T> {
8989
let mut node_iter = NodeIter { stack: Vec::new() };
9090
// Initialize stack with path to leftmost child
9191
let mut child = &self.root;
@@ -97,7 +97,7 @@ impl<T: Ord> Treap<T> {
9797
}
9898

9999
/// Returns an iterator that visits the values in the tree in ascending order.
100-
pub fn iter(&self) -> Iter<T> {
100+
pub fn iter(&self) -> Iter<'_, T> {
101101
Iter {
102102
node_iter: self.node_iter(),
103103
}

src/data_structures/veb_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl VebTree {
5858
self.max
5959
}
6060

61-
pub fn iter(&self) -> VebTreeIter {
61+
pub fn iter(&self) -> VebTreeIter<'_> {
6262
VebTreeIter::new(self)
6363
}
6464

src/general/genetic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub trait SelectionStrategy<Rng: rand::Rng> {
3636

3737
/// A roulette wheel selection strategy
3838
/// https://en.wikipedia.org/wiki/Fitness_proportionate_selection
39+
#[allow(dead_code)]
3940
pub struct RouletteWheel<Rng: rand::Rng> {
4041
rng: Rng,
4142
}
@@ -84,6 +85,7 @@ impl<Rng: rand::Rng> SelectionStrategy<Rng> for RouletteWheel<Rng> {
8485
}
8586
}
8687

88+
#[allow(dead_code)]
8789
pub struct Tournament<const K: usize, Rng: rand::Rng> {
8890
rng: Rng,
8991
}

src/math/random.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl PCG32 {
102102
pub fn get_state(&self) -> u64 {
103103
self.state
104104
}
105-
pub fn iter_mut(&mut self) -> IterMut {
105+
pub fn iter_mut(&mut self) -> IterMut<'_> {
106106
IterMut { pcg: self }
107107
}
108108
}

0 commit comments

Comments
 (0)