Skip to content

Commit 4e85e41

Browse files
authored
fix: remove cmp to calculate range
1 parent 1220989 commit 4e85e41

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, Pat, PatKind, StmtKind}
1212
use rustc_lint::LateContext;
1313
use rustc_middle::ty::{self, Ty};
1414
use rustc_span::symbol::sym;
15-
use std::cmp;
1615
use std::fmt::Display;
1716
use std::iter::Iterator;
1817

@@ -475,7 +474,7 @@ fn is_array_length_equal_to_range(cx: &LateContext<'_>, start: &Expr<'_>, end: &
475474
};
476475

477476
let range = match (extract_lit_value(start), extract_lit_value(end)) {
478-
(Some(start_value), Some(end_value)) => cmp::max(start_value, end_value) - cmp::min(start_value, end_value),
477+
(Some(start_value), Some(end_value)) => end_value - start_value,
479478
_ => return false,
480479
};
481480

0 commit comments

Comments
 (0)