diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fea31503..fc56edb9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,7 +14,7 @@ jobs: run: | cd rust cargo fmt -- --check - RUSTFLAGS="-A unused" cargo clippy + RUSTFLAGS="-A unused" cargo clippy -- -Dwarnings cargo clippy --tests - name: compile and test run: | diff --git a/rust/structures/mergeable_heap.rs b/rust/structures/mergeable_heap.rs index 576a1d81..306c815b 100644 --- a/rust/structures/mergeable_heap.rs +++ b/rust/structures/mergeable_heap.rs @@ -59,7 +59,7 @@ mod tests { #[case(&mut [1, 1])] #[case(&mut [3, 1, 2])] fn basic_test(#[case] seq: &mut [u32]) { - let heap_sorted_values = sort_with_heap(&seq); + let heap_sorted_values = sort_with_heap(seq); seq.sort(); assert_eq!(heap_sorted_values, seq); } @@ -92,7 +92,7 @@ mod tests { } fn sort_with_heap(seq: &[u32]) -> Vec { - let mut heap = seq.iter().fold(None, |h, v| Heap::insert(h, v)); + let mut heap = seq.iter().fold(None, Heap::insert); let mut heap_sorted_values = Vec::new(); while heap.is_some() { let (updated_heap, min_value) = Heap::remove_min(heap); diff --git a/rust/structures/treap.rs b/rust/structures/treap.rs index 80e66276..d5eb710d 100644 --- a/rust/structures/treap.rs +++ b/rust/structures/treap.rs @@ -21,7 +21,7 @@ impl Trea value, mx: value, add: V::default(), - prio: rand::thread_rng().gen_range(0..1000_000_000), + prio: rand::thread_rng().gen_range(0..1_000_000_000), size: 1, left: None, right: None, @@ -59,6 +59,7 @@ impl Trea node.as_ref().map_or(value, |t| max(t.mx, value)) } + #[allow(clippy::type_complexity)] pub fn split( root: Option>>, min_right: K, @@ -66,6 +67,7 @@ impl Trea Self::inner_split(root, min_right, |a, b| a >= b) } + #[allow(clippy::type_complexity)] pub fn strict_split( root: Option>>, min_right: K, @@ -73,6 +75,7 @@ impl Trea Self::inner_split(root, min_right, |a, b| a > b) } + #[allow(clippy::type_complexity)] fn inner_split bool>( root: Option>>, min_right: K, @@ -139,6 +142,7 @@ impl Trea ) -> Option>> { let (l1, r1) = Self::strict_split(root, rr); let (l2, mut r2) = Self::split(l1, ll); + #[allow(clippy::option_map_unit_fn)] r2.as_mut().map(|t| t.apply(delta)); Self::merge(Self::merge(l2, r2), r1) } @@ -167,7 +171,6 @@ mod tests { treap = Treap::modify(treap, 1, 2, 100); let (t, q2) = Treap::query(treap, 1, 2); - treap = t; assert_eq!(q2, 120); } }