File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,30 @@ declare_clippy_lint! {
1414 /// Checks for instances of `mut mut` references.
1515 ///
1616 /// ### Why is this bad?
17- /// Multiple `mut`s don't add anything meaningful to the
18- /// source. This is either a copy'n'paste error, or it shows a fundamental
19- /// misunderstanding of references.
17+ /// This is usually just a typo or a misunderstanding of how references work.
2018 ///
2119 /// ### Example
2220 /// ```no_run
23- /// # let mut y = 1;
24- /// let x = &mut &mut y;
21+ /// let x = &mut &mut 1;
22+ ///
23+ /// let mut x = &mut 1;
24+ /// let y = &mut x;
25+ ///
26+ /// fn foo(x: &mut &mut u32) {}
27+ /// ```
28+ /// Use instead
29+ /// ```no_run
30+ /// let x = &mut 1;
31+ ///
32+ /// let mut x = &mut 1;
33+ /// let y = &mut *x; // reborrow
34+ ///
35+ /// fn foo(x: &mut u32) {}
2536 /// ```
2637 #[ clippy:: version = "pre 1.29.0" ]
2738 pub MUT_MUT ,
2839 pedantic,
29- "usage of double-mut refs, e.g., `&mut &mut ...`"
40+ "usage of double mut- refs, e.g., `&mut &mut ...`"
3041}
3142
3243impl_lint_pass ! ( MutMut => [ MUT_MUT ] ) ;
You can’t perform that action at this time.
0 commit comments