X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Fcopies.rs;h=9cbcde597686e8c212c45ce95d4e28ad954624cf;hb=78ffcd9959cc81d1328fcafb996dcc7cd9b5f1ac;hp=aea1accccc6581838f8710390682d8cda33f3819;hpb=8131445e536869b4b73b07d1be1b2e03f7493898;p=rust.git diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index aea1accccc6..9cbcde59768 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -120,7 +120,10 @@ /// /// **Why is this bad?** Duplicate code is less maintainable. /// - /// **Known problems:** Hopefully none. + /// **Known problems:** + /// * The lint doesn't check if the moved expressions modify values that are beeing used in + /// the if condition. The suggestion can in that case modify the behavior of the program. + /// See [rust-clippy#7452](https://github.com/rust-lang/rust-clippy/issues/7452) /// /// **Example:** /// ```ignore @@ -358,8 +361,7 @@ fn scan_block_for_eq(cx: &LateContext<'tcx>, blocks: &[&Block<'tcx>]) -> Option< expr_eq &= block_expr_eq; } - let has_expr = blocks[0].expr.is_some(); - if has_expr && !expr_eq { + if !expr_eq { end_eq = 0; }