Skip to content

Commit 58b7dfa

Browse files
committed
doc: add more examples, and a "Use instead" section
1 parent 52c6c53 commit 58b7dfa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

clippy_lints/src/mut_mut.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@ declare_clippy_lint! {
2020
///
2121
/// ### Example
2222
/// ```no_run
23-
/// # let mut y = 1;
24-
/// let x = &mut &mut y;
23+
/// let x = &mut &mut 1;
24+
///
25+
/// let mut x = &mut 1;
26+
/// let y = &mut x;
27+
///
28+
/// fn foo(x: &mut &mut u32) {}
29+
/// ```
30+
/// Use instead
31+
/// ```no_run
32+
/// let x = &mut 1;
33+
///
34+
/// let mut x = &mut 1;
35+
/// let y = &mut *x; // reborrow
36+
///
37+
/// fn foo(x: &mut u32) {}
2538
/// ```
2639
#[clippy::version = "pre 1.29.0"]
2740
pub MUT_MUT,

0 commit comments

Comments
 (0)