Skip to content

Commit ad9ad6f

Browse files
committed
Don't negate resulted offsets when offset is subtraction by 0
1 parent 5d8a3e8 commit ad9ad6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/loops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,8 @@ fn detect_manual_memcpy<'a, 'tcx>(
960960
let print_sum = |arg1: &Offset, arg2: &Offset| -> String {
961961
match (&arg1.value[..], arg1.negate, &arg2.value[..], arg2.negate) {
962962
("0", _, "0", _) => "".into(),
963-
("0", _, x, false) | (x, false, "0", false) => x.into(),
964-
("0", _, x, true) | (x, false, "0", true) => format!("-{}", x),
963+
("0", _, x, false) | (x, false, "0", _) => x.into(),
964+
("0", _, x, true) => format!("-{}", x),
965965
(x, false, y, false) => format!("({} + {})", x, y),
966966
(x, false, y, true) => {
967967
if x == y {

0 commit comments

Comments
 (0)