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! {
14
14
/// Checks for instances of `mut mut` references.
15
15
///
16
16
/// ### 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.
20
18
///
21
19
/// ### Example
22
20
/// ```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) {}
25
36
/// ```
26
37
#[ clippy:: version = "pre 1.29.0" ]
27
38
pub MUT_MUT ,
28
39
pedantic,
29
- "usage of double-mut refs, e.g., `&mut &mut ...`"
40
+ "usage of double mut- refs, e.g., `&mut &mut ...`"
30
41
}
31
42
32
43
impl_lint_pass ! ( MutMut => [ MUT_MUT ] ) ;
You can’t perform that action at this time.
0 commit comments