mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Improve documentation on match_ref_pats (fixes #532)
This commit is contained in:
parent
c11d140ebf
commit
32cf6e32f6
2 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ name
|
|||
[linkedlist](https://github.com/Manishearth/rust-clippy/wiki#linkedlist) | warn | usage of LinkedList, usually a vector is faster, or a more specialized data structure like a VecDeque
|
||||
[map_clone](https://github.com/Manishearth/rust-clippy/wiki#map_clone) | warn | using `.map(|x| x.clone())` to clone an iterator or option's contents (recommends `.cloned()` instead)
|
||||
[match_bool](https://github.com/Manishearth/rust-clippy/wiki#match_bool) | warn | a match on boolean expression; recommends `if..else` block instead
|
||||
[match_ref_pats](https://github.com/Manishearth/rust-clippy/wiki#match_ref_pats) | warn | a match has all arms prefixed with `&`; the match expression can be dereferenced instead
|
||||
[match_ref_pats](https://github.com/Manishearth/rust-clippy/wiki#match_ref_pats) | warn | a match or `if let` has all arms prefixed with `&`; the match expression can be dereferenced instead
|
||||
[min_max](https://github.com/Manishearth/rust-clippy/wiki#min_max) | warn | `min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant
|
||||
[modulo_one](https://github.com/Manishearth/rust-clippy/wiki#modulo_one) | warn | taking a number modulo 1, which always returns 0
|
||||
[mut_mut](https://github.com/Manishearth/rust-clippy/wiki#mut_mut) | allow | usage of double-mut refs, e.g. `&mut &mut ...` (either copy'n'paste error, or shows a fundamental misunderstanding of references)
|
||||
|
|
|
@ -22,7 +22,7 @@ use utils::{snippet, span_lint, span_help_and_lint, in_external_macro, expr_bloc
|
|||
declare_lint!(pub SINGLE_MATCH, Warn,
|
||||
"a match statement with a single nontrivial arm (i.e, where the other arm \
|
||||
is `_ => {}`) is used; recommends `if let` instead");
|
||||
/// **What it does:** This lint checks for matches where all arms match a reference, suggesting to remove the reference and deref the matched expression instead. It is `Warn` by default.
|
||||
/// **What it does:** This lint checks for matches where all arms match a reference, suggesting to remove the reference and deref the matched expression instead. It also checks for `if let &foo = bar` blocks. It is `Warn` by default.
|
||||
///
|
||||
/// **Why is this bad?** It just makes the code less readable. That reference destructuring adds nothing to the code.
|
||||
///
|
||||
|
@ -38,7 +38,7 @@ declare_lint!(pub SINGLE_MATCH, Warn,
|
|||
/// }
|
||||
/// ```
|
||||
declare_lint!(pub MATCH_REF_PATS, Warn,
|
||||
"a match has all arms prefixed with `&`; the match expression can be \
|
||||
"a match or `if let` has all arms prefixed with `&`; the match expression can be \
|
||||
dereferenced instead");
|
||||
/// **What it does:** This lint checks for matches where match expression is a `bool`. It suggests to replace the expression with an `if...else` block. It is `Warn` by default.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue