Add examples to some correctness lints
This commit is contained in:
parent
6d9ee9e5eb
commit
43a2ba34e6
@ -889,6 +889,10 @@ declare_clippy_lint! {
|
||||
/// ```rust
|
||||
/// let _ = [1, 2, 3].into_iter().map(|x| *x).collect::<Vec<u32>>();
|
||||
/// ```
|
||||
/// Could be written as:
|
||||
/// ```rust
|
||||
/// let _ = [1, 2, 3].iter().map(|x| *x).collect::<Vec<u32>>();
|
||||
/// ```
|
||||
pub INTO_ITER_ON_ARRAY,
|
||||
correctness,
|
||||
"using `.into_iter()` on an array"
|
||||
|
@ -52,6 +52,12 @@ declare_clippy_lint! {
|
||||
/// a = b;
|
||||
/// b = a;
|
||||
/// ```
|
||||
/// Could be written as:
|
||||
/// ```rust
|
||||
/// # let mut a = 1;
|
||||
/// # let mut b = 2;
|
||||
/// std::mem::swap(&mut a, &mut b);
|
||||
/// ```
|
||||
pub ALMOST_SWAPPED,
|
||||
correctness,
|
||||
"`foo = bar; bar = foo` sequence"
|
||||
|
Loading…
Reference in New Issue
Block a user