]> git.lizzy.rs Git - rust.git/blob - src/docs/unnecessary_mut_passed.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / unnecessary_mut_passed.txt
1 ### What it does
2 Detects passing a mutable reference to a function that only
3 requires an immutable reference.
4
5 ### Why is this bad?
6 The mutable reference rules out all other references to
7 the value. Also the code misleads about the intent of the call site.
8
9 ### Example
10 ```
11 vec.push(&mut value);
12 ```
13
14 Use instead:
15 ```
16 vec.push(&value);
17 ```