Skip to content

style: include useless_let_if_seq #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,5 @@ redundant_pub_crate = { level = "allow", priority = 1 }
suboptimal_flops = { level = "allow", priority = 1 }
suspicious_operation_groupings = { level = "allow", priority = 1 }
use_self = { level = "allow", priority = 1 }
useless_let_if_seq = { level = "allow", priority = 1 }
# cargo-lints:
cargo_common_metadata = { level = "allow", priority = 1 }
11 changes: 5 additions & 6 deletions src/math/zellers_congruence_algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

pub fn zellers_congruence_algorithm(date: i32, month: i32, year: i32, as_string: bool) -> String {
let q = date;
let mut m = month;
let mut y = year;
if month < 3 {
m = month + 12;
y = year - 1;
}
let (m, y) = if month < 3 {
(month + 12, year - 1)
} else {
(month, year)
};
let day: i32 =
(q + (26 * (m + 1) / 10) + (y % 100) + ((y % 100) / 4) + ((y / 100) / 4) + (5 * (y / 100)))
% 7;
Expand Down
9 changes: 5 additions & 4 deletions src/sorting/heap_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ fn build_heap<T: Ord>(arr: &mut [T], is_max_heap: bool) {
/// * `i` - The index to start fixing the heap violation.
/// * `is_max_heap` - A boolean indicating whether to maintain a max heap or a min heap.
fn heapify<T: Ord>(arr: &mut [T], i: usize, is_max_heap: bool) {
let mut comparator: fn(&T, &T) -> Ordering = |a, b| a.cmp(b);
if !is_max_heap {
comparator = |a, b| b.cmp(a);
}
let comparator: fn(&T, &T) -> Ordering = if !is_max_heap {
|a, b| b.cmp(a)
} else {
|a, b| a.cmp(b)
};

let mut idx = i;
let l = 2 * i + 1;
Expand Down