{"record":{"id":"54a93e7b039bda7e","repo":"rust-lang/rust-clippy","slug":"some-moved-values-might-need-to-be-renamed-to-avoi","errorCode":null,"errorMessage":"some moved values might need to be renamed to avoid wrong references","messagePattern":"some moved values might need to be renamed to avoid wrong references","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clippy_lints/src/ifs/branches_sharing_code.rs","lineNumber":101,"sourceCode":"                span,\n                \"consider moving these statements before the if\",\n                sugg,\n                Applicability::Unspecified,\n            );\n        }\n        if let Some((span, sugg)) = end_suggestion {\n            diag.span_suggestion(\n                span,\n                \"consider moving these statements after the if\",\n                sugg,\n                Applicability::Unspecified,\n            );\n            if is_expr_parent_assignment(cx, expr) || !cx.typeck_results().expr_ty(expr).is_unit() {\n                diag.note(\"the end suggestion probably needs some adjustments to use the expression result correctly\");\n            }\n        }\n        if check_for_warn_of_moved_symbol(cx, &res.moved_locals, expr) {\n            diag.warn(\"some moved values might need to be renamed to avoid wrong references\");\n        }\n    });\n}\n\n/// Detects `match` expressions where every arm's body is a block ending in the same trailing\n/// expression, so that expression can be hoisted out below the `match`.\n///\n/// ```ignore\n/// match mode {\n///     Mode::A => { a(); Ok(()) }\n///     Mode::B => { b(); Ok(()) }\n/// }\n/// ```\n/// can become\n/// ```ignore\n/// match mode {\n///     Mode::A => a(),\n///     Mode::B => b(),","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/rust-lang/rust-clippy/blob/13aece11388703700981f29d9480ffd6409a3192/clippy_lints/src/ifs/branches_sharing_code.rs#L83-L119","documentation":"A note attached to the branches_sharing_code lint's move-after-if suggestion: after hoisting duplicated tail statements out of the branches, bindings moved into the extracted code may still be referenced by name in the branches (or vice versa), so the same identifier can now refer to the pre-move binding while the value actually lives in the moved statement. The suggestion is emitted with Applicability::Unspecified precisely because identifiers may need renaming; the note additionally warns when the if expression's value is consumed (e.g. assigned), making the end-suggestion riskier.","triggerScenarios":"Thrown at clippy_lints/src/ifs/branches_sharing_code.rs:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Apply the move suggestion, then rename the affected variables so each reference points at the intended binding","Re-run cargo check after the move to catch any borrow/move errors introduced by the hoisting","If the statement order or value flow is too entangled, skip the automated suggestion and refactor manually"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13aece11388703700981f29d9480ffd6409a3192","analyzedAt":"2026-09-07T23:08:18.134Z","contentChangedAt":"2026-09-07T23:08:18.134Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}