Skip to content

Commit bda0423

Browse files
committed
Refactor statement to determine width of range
1 parent 4ee6f58 commit bda0423

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clippy_lints/src/methods/map_with_unused_argument_over_ranges.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ fn extract_count_with_applicability(
2929
&& let LitKind::Int(Pu128(upper_bound), _) = lit.node
3030
{
3131
// Here we can explicitly calculate the number of iterations
32-
let count = if upper_bound > lower_bound {
32+
let count = if upper_bound >= lower_bound {
3333
match range.limits {
3434
RangeLimits::HalfOpen => upper_bound - lower_bound,
3535
RangeLimits::Closed => upper_bound - lower_bound + 1,
3636
}
37-
} else if upper_bound == lower_bound && range.limits == RangeLimits::Closed {
38-
1
3937
} else {
4038
0
4139
};

0 commit comments

Comments
 (0)