This commit is contained in:
flip1995 2019-10-26 21:53:42 +02:00
parent e402ddd616
commit 4a52dd6c53
No known key found for this signature in database
GPG Key ID: 693086869D506637
22 changed files with 108 additions and 0 deletions

View File

@ -19,6 +19,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a += 1 + a; LL | a += 1 + a;
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with
| |
LL | a += 1; LL | a += 1;
@ -33,6 +34,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a -= a - 1; LL | a -= a - 1;
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with
| |
LL | a -= 1; LL | a -= 1;
@ -47,6 +49,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a *= a * 99; LL | a *= a * 99;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with
| |
LL | a *= 99; LL | a *= 99;
@ -61,6 +64,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a *= 42 * a; LL | a *= 42 * a;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with
| |
LL | a *= 42; LL | a *= 42;
@ -75,6 +79,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a /= a / 2; LL | a /= a / 2;
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with
| |
LL | a /= 2; LL | a /= 2;
@ -89,6 +94,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a %= a % 5; LL | a %= a % 5;
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with
| |
LL | a %= 5; LL | a %= 5;
@ -103,6 +109,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a &= a & 1; LL | a &= a & 1;
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with
| |
LL | a &= 1; LL | a &= 1;
@ -117,6 +124,7 @@ error: variable appears on both sides of an assignment operation
| |
LL | a *= a * a; LL | a *= a * a;
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: Did you mean a = a * a or a = a * a * a? Consider replacing it with help: Did you mean a = a * a or a = a * a * a? Consider replacing it with
| |
LL | a *= a; LL | a *= a;

View File

@ -72,6 +72,7 @@ error: this boolean expression can be simplified
| |
LL | let _ = a == b && c == 5 && a == b; LL | let _ = a == b && c == 5 && a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try help: try
| |
LL | let _ = a == b && c == 5; LL | let _ = a == b && c == 5;
@ -84,6 +85,7 @@ error: this boolean expression can be simplified
| |
LL | let _ = a == b && c == 5 && b == a; LL | let _ = a == b && c == 5 && b == a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try help: try
| |
LL | let _ = a == b && c == 5; LL | let _ = a == b && c == 5;
@ -120,6 +122,7 @@ error: this boolean expression can be simplified
| |
LL | let _ = a != b || !(a != b || c == d); LL | let _ = a != b || !(a != b || c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try help: try
| |
LL | let _ = c != d || a != b; LL | let _ = c != d || a != b;

View File

@ -25,6 +25,7 @@ LL | | println!("Hello world!");
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
@ -41,6 +42,7 @@ LL | | println!("Hello world!");
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") { LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
@ -57,6 +59,7 @@ LL | | println!("Hello world!");
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" { LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
@ -73,6 +76,7 @@ LL | | println!("Hello world!");
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if x == "hello" && x == "world" && y == "world" && y == "hello" { LL | if x == "hello" && x == "world" && y == "world" && y == "hello" {
@ -89,6 +93,7 @@ LL | | println!("world!")
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if 42 == 1337 && 'a' != 'A' { LL | if 42 == 1337 && 'a' != 'A' {
@ -106,6 +111,7 @@ LL | | println!("world!")
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if y == "world" { LL | } else if y == "world" {
@ -123,6 +129,7 @@ LL | | println!("world!")
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if let Some(42) = Some(42) { LL | } else if let Some(42) = Some(42) {
@ -142,6 +149,7 @@ LL | | }
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if y == "world" { LL | } else if y == "world" {
@ -164,6 +172,7 @@ LL | | }
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if let Some(42) = Some(42) { LL | } else if let Some(42) = Some(42) {
@ -186,6 +195,7 @@ LL | | }
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if let Some(42) = Some(42) { LL | } else if let Some(42) = Some(42) {
@ -208,6 +218,7 @@ LL | | }
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if x == "hello" { LL | } else if x == "hello" {
@ -230,6 +241,7 @@ LL | | }
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | } else if let Some(42) = Some(42) { LL | } else if let Some(42) = Some(42) {
@ -249,6 +261,7 @@ LL | | println!("Hello world!");
LL | | } LL | | }
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if x == "hello" && y == "world" { // Collapsible LL | if x == "hello" && y == "world" { // Collapsible

View File

@ -15,6 +15,7 @@ error: `dbg!` macro is intended as a debugging tool
| |
LL | if dbg!(n <= 1) { LL | if dbg!(n <= 1) {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: ensure to avoid having uses of it in version control help: ensure to avoid having uses of it in version control
| |
LL | if n <= 1 { LL | if n <= 1 {
@ -25,6 +26,7 @@ error: `dbg!` macro is intended as a debugging tool
| |
LL | dbg!(1) LL | dbg!(1)
| ^^^^^^^ | ^^^^^^^
|
help: ensure to avoid having uses of it in version control help: ensure to avoid having uses of it in version control
| |
LL | 1 LL | 1
@ -35,6 +37,7 @@ error: `dbg!` macro is intended as a debugging tool
| |
LL | dbg!(n * factorial(n - 1)) LL | dbg!(n * factorial(n - 1))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: ensure to avoid having uses of it in version control help: ensure to avoid having uses of it in version control
| |
LL | n * factorial(n - 1) LL | n * factorial(n - 1)
@ -45,6 +48,7 @@ error: `dbg!` macro is intended as a debugging tool
| |
LL | dbg!(42); LL | dbg!(42);
| ^^^^^^^^ | ^^^^^^^^
|
help: ensure to avoid having uses of it in version control help: ensure to avoid having uses of it in version control
| |
LL | 42; LL | 42;
@ -55,6 +59,7 @@ error: `dbg!` macro is intended as a debugging tool
| |
LL | dbg!(dbg!(dbg!(42))); LL | dbg!(dbg!(dbg!(42)));
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
|
help: ensure to avoid having uses of it in version control help: ensure to avoid having uses of it in version control
| |
LL | dbg!(dbg!(42)); LL | dbg!(dbg!(42));
@ -65,6 +70,7 @@ error: `dbg!` macro is intended as a debugging tool
| |
LL | foo(3) + dbg!(factorial(4)); LL | foo(3) + dbg!(factorial(4));
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
|
help: ensure to avoid having uses of it in version control help: ensure to avoid having uses of it in version control
| |
LL | foo(3) + factorial(4); LL | foo(3) + factorial(4);

View File

@ -15,6 +15,7 @@ error: you seem to want to iterate on a map's values
| |
LL | for (_, v) in &*m { LL | for (_, v) in &*m {
| ^^^ | ^^^
|
help: use the corresponding method help: use the corresponding method
| |
LL | for v in (*m).values() { LL | for v in (*m).values() {
@ -25,6 +26,7 @@ error: you seem to want to iterate on a map's values
| |
LL | for (_, v) in &mut m { LL | for (_, v) in &mut m {
| ^^^^^^ | ^^^^^^
|
help: use the corresponding method help: use the corresponding method
| |
LL | for v in m.values_mut() { LL | for v in m.values_mut() {
@ -35,6 +37,7 @@ error: you seem to want to iterate on a map's values
| |
LL | for (_, v) in &mut *m { LL | for (_, v) in &mut *m {
| ^^^^^^^ | ^^^^^^^
|
help: use the corresponding method help: use the corresponding method
| |
LL | for v in (*m).values_mut() { LL | for v in (*m).values_mut() {
@ -45,6 +48,7 @@ error: you seem to want to iterate on a map's keys
| |
LL | for (k, _value) in rm { LL | for (k, _value) in rm {
| ^^ | ^^
|
help: use the corresponding method help: use the corresponding method
| |
LL | for k in rm.keys() { LL | for k in rm.keys() {

View File

@ -15,6 +15,7 @@ error: this range is empty so this for loop will never run
| |
LL | for i in 10..=0 { LL | for i in 10..=0 {
| ^^^^^^ | ^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse help: consider using the following if you are attempting to iterate over this range in reverse
| |
LL | for i in (0..=10).rev() { LL | for i in (0..=10).rev() {
@ -25,6 +26,7 @@ error: this range is empty so this for loop will never run
| |
LL | for i in MAX_LEN..0 { LL | for i in MAX_LEN..0 {
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse help: consider using the following if you are attempting to iterate over this range in reverse
| |
LL | for i in (0..MAX_LEN).rev() { LL | for i in (0..MAX_LEN).rev() {
@ -35,6 +37,7 @@ error: this range is empty so this for loop will never run
| |
LL | for i in 10..5 + 4 { LL | for i in 10..5 + 4 {
| ^^^^^^^^^ | ^^^^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse help: consider using the following if you are attempting to iterate over this range in reverse
| |
LL | for i in (5 + 4..10).rev() { LL | for i in (5 + 4..10).rev() {
@ -45,6 +48,7 @@ error: this range is empty so this for loop will never run
| |
LL | for i in (5 + 2)..(3 - 1) { LL | for i in (5 + 2)..(3 - 1) {
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse help: consider using the following if you are attempting to iterate over this range in reverse
| |
LL | for i in ((3 - 1)..(5 + 2)).rev() { LL | for i in ((3 - 1)..(5 + 2)).rev() {

View File

@ -19,6 +19,7 @@ error: impl for `HashMap` should be generalized over different hashers
| |
LL | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) { LL | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) {
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) { LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
@ -33,6 +34,7 @@ error: impl for `HashMap` should be generalized over different hashers
| |
LL | impl Foo<i16> for HashMap<String, String> { LL | impl Foo<i16> for HashMap<String, String> {
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> { LL | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
@ -47,6 +49,7 @@ error: impl for `HashSet` should be generalized over different hashers
| |
LL | impl<T: Hash + Eq> Foo<i8> for HashSet<T> { LL | impl<T: Hash + Eq> Foo<i8> for HashSet<T> {
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> { LL | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
@ -61,6 +64,7 @@ error: impl for `HashSet` should be generalized over different hashers
| |
LL | impl Foo<i16> for HashSet<String> { LL | impl Foo<i16> for HashSet<String> {
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> { LL | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
@ -75,6 +79,7 @@ error: parameter of type `HashMap` should be generalized over different hashers
| |
LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {} LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {} LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
@ -85,6 +90,7 @@ error: parameter of type `HashSet` should be generalized over different hashers
| |
LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {} LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {} LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}
@ -98,6 +104,7 @@ LL | impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
... ...
LL | gen!(impl); LL | gen!(impl);
| ----------- in this macro invocation | ----------- in this macro invocation
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> { LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
@ -115,6 +122,7 @@ LL | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>)
... ...
LL | gen!(fn bar); LL | gen!(fn bar);
| ------------- in this macro invocation | ------------- in this macro invocation
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {} LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
@ -128,6 +136,7 @@ LL | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>)
... ...
LL | gen!(fn bar); LL | gen!(fn bar);
| ------------- in this macro invocation | ------------- in this macro invocation
|
help: consider adding a type parameter help: consider adding a type parameter
| |
LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {} LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}

View File

@ -27,6 +27,7 @@ error: large size difference between variants
| |
LL | ContainingLargeEnum(LargeEnum), LL | ContainingLargeEnum(LargeEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider boxing the large fields to reduce the total size of the enum help: consider boxing the large fields to reduce the total size of the enum
| |
LL | ContainingLargeEnum(Box<LargeEnum>), LL | ContainingLargeEnum(Box<LargeEnum>),
@ -61,6 +62,7 @@ error: large size difference between variants
| |
LL | StructLikeLarge2 { x: [i32; 8000] }, LL | StructLikeLarge2 { x: [i32; 8000] },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider boxing the large fields to reduce the total size of the enum help: consider boxing the large fields to reduce the total size of the enum
| |
LL | StructLikeLarge2 { x: Box<[i32; 8000]> }, LL | StructLikeLarge2 { x: Box<[i32; 8000]> },

View File

@ -20,6 +20,7 @@ LL | let x = 5;
| ---------- unnecessary let binding | ---------- unnecessary let binding
LL | x LL | x
| ^ | ^
|
help: return the expression directly help: return the expression directly
| |
LL | LL |

View File

@ -23,6 +23,7 @@ LL | | .map(|_| ())
LL | | .next() LL | | .next()
LL | | .unwrap(); LL | | .unwrap();
| |__________________^ | |__________________^
|
help: omit the `let` binding help: omit the `let` binding
| |
LL | v LL | v

View File

@ -39,6 +39,7 @@ error: this is a decimal constant
| |
LL | let fail8 = 0123; LL | let fail8 = 0123;
| ^^^^ | ^^^^
|
help: if you mean to use a decimal constant, remove the `0` to avoid confusion help: if you mean to use a decimal constant, remove the `0` to avoid confusion
| |
LL | let fail8 = 123; LL | let fail8 = 123;

View File

@ -35,6 +35,7 @@ error: it looks like you're manually copying between slices
| |
LL | for i in 10..256 { LL | for i in 10..256 {
| ^^^^^^^ | ^^^^^^^
|
help: try replacing the loop by help: try replacing the loop by
| |
LL | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]) LL | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])

View File

@ -36,6 +36,7 @@ LL | | println!("Noooo!");
LL | | }, LL | | },
LL | | }; LL | | };
| |_____^ | |_____^
|
help: consider using an if/else expression help: consider using an if/else expression
| |
LL | if !test { LL | if !test {
@ -53,6 +54,7 @@ LL | | },
LL | | _ => (), LL | | _ => (),
LL | | }; LL | | };
| |_____^ | |_____^
|
help: consider using an if/else expression help: consider using an if/else expression
| |
LL | if !test { LL | if !test {
@ -70,6 +72,7 @@ LL | | },
LL | | _ => (), LL | | _ => (),
LL | | }; LL | | };
| |_____^ | |_____^
|
help: consider using an if/else expression help: consider using an if/else expression
| |
LL | if !(test && test) { LL | if !(test && test) {
@ -96,6 +99,7 @@ LL | | },
LL | | }, LL | | },
LL | | }; LL | | };
| |_____^ | |_____^
|
help: consider using an if/else expression help: consider using an if/else expression
| |
LL | if test { LL | if test {

View File

@ -23,6 +23,7 @@ LL | | &(v, 1) => println!("{}", v),
LL | | _ => println!("none"), LL | | _ => println!("none"),
LL | | } LL | | }
| |_____^ | |_____^
|
help: instead of prefixing all patterns with `&`, you can dereference the expression help: instead of prefixing all patterns with `&`, you can dereference the expression
| |
LL | match *tup { LL | match *tup {
@ -37,6 +38,7 @@ LL | | &Some(v) => println!("{:?}", v),
LL | | &None => println!("none"), LL | | &None => println!("none"),
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | match w { LL | match w {
@ -51,6 +53,7 @@ LL | / if let &None = a {
LL | | println!("none"); LL | | println!("none");
LL | | } LL | | }
| |_____^ | |_____^
|
help: instead of prefixing all patterns with `&`, you can dereference the expression help: instead of prefixing all patterns with `&`, you can dereference the expression
| |
LL | if let None = *a { LL | if let None = *a {
@ -63,6 +66,7 @@ LL | / if let &None = &b {
LL | | println!("none"); LL | | println!("none");
LL | | } LL | | }
| |_____^ | |_____^
|
help: try help: try
| |
LL | if let None = b { LL | if let None = b {
@ -76,6 +80,7 @@ LL | | &Foo::A => println!("A"),
LL | | _ => println!("Wild"), LL | | _ => println!("Wild"),
LL | | } LL | | }
| |_________^ | |_________^
|
help: instead of prefixing all patterns with `&`, you can dereference the expression help: instead of prefixing all patterns with `&`, you can dereference the expression
| |
LL | match *foo_variant!(0) { LL | match *foo_variant!(0) {

View File

@ -59,6 +59,7 @@ error: this argument is passed by value, but not consumed in the function body
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^ | ^^^^^^
|
help: consider changing the type to help: consider changing the type to
| |
LL | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
@ -79,6 +80,7 @@ error: this argument is passed by value, but not consumed in the function body
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^^^ | ^^^^^^^^
|
help: consider changing the type to help: consider changing the type to
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {

View File

@ -15,6 +15,7 @@ error: the loop variable `i` is only used to index `ms`.
| |
LL | for i in 0..ms.len() { LL | for i in 0..ms.len() {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &mut ms { LL | for <item> in &mut ms {
@ -25,6 +26,7 @@ error: the loop variable `i` is only used to index `ms`.
| |
LL | for i in 0..ms.len() { LL | for i in 0..ms.len() {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &mut ms { LL | for <item> in &mut ms {
@ -35,6 +37,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in x..x + 4 { LL | for i in x..x + 4 {
| ^^^^^^^^ | ^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter_mut().skip(x).take(4) { LL | for <item> in vec.iter_mut().skip(x).take(4) {
@ -45,6 +48,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in x..=x + 4 { LL | for i in x..=x + 4 {
| ^^^^^^^^^ | ^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter_mut().skip(x).take(4 + 1) { LL | for <item> in vec.iter_mut().skip(x).take(4 + 1) {
@ -55,6 +59,7 @@ error: the loop variable `i` is only used to index `arr`.
| |
LL | for i in 0..3 { LL | for i in 0..3 {
| ^^^^ | ^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &arr { LL | for <item> in &arr {
@ -65,6 +70,7 @@ error: the loop variable `i` is only used to index `arr`.
| |
LL | for i in 0..2 { LL | for i in 0..2 {
| ^^^^ | ^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in arr.iter().take(2) { LL | for <item> in arr.iter().take(2) {
@ -75,6 +81,7 @@ error: the loop variable `i` is only used to index `arr`.
| |
LL | for i in 1..3 { LL | for i in 1..3 {
| ^^^^ | ^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in arr.iter().skip(1) { LL | for <item> in arr.iter().skip(1) {
@ -85,6 +92,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 0..vec.len() { LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &vec { LL | for <item> in &vec {
@ -95,6 +103,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 0..vec.len() { LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &vec { LL | for <item> in &vec {
@ -105,6 +114,7 @@ error: the loop variable `j` is only used to index `STATIC`.
| |
LL | for j in 0..4 { LL | for j in 0..4 {
| ^^^^ | ^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &STATIC { LL | for <item> in &STATIC {
@ -115,6 +125,7 @@ error: the loop variable `j` is only used to index `CONST`.
| |
LL | for j in 0..4 { LL | for j in 0..4 {
| ^^^^ | ^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in &CONST { LL | for <item> in &CONST {
@ -125,6 +136,7 @@ error: the loop variable `i` is used to index `vec`
| |
LL | for i in 0..vec.len() { LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for (i, <item>) in vec.iter().enumerate() { LL | for (i, <item>) in vec.iter().enumerate() {
@ -135,6 +147,7 @@ error: the loop variable `i` is only used to index `vec2`.
| |
LL | for i in 0..vec.len() { LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec2.iter().take(vec.len()) { LL | for <item> in vec2.iter().take(vec.len()) {
@ -145,6 +158,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 5..vec.len() { LL | for i in 5..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter().skip(5) { LL | for <item> in vec.iter().skip(5) {
@ -155,6 +169,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 0..MAX_LEN { LL | for i in 0..MAX_LEN {
| ^^^^^^^^^^ | ^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter().take(MAX_LEN) { LL | for <item> in vec.iter().take(MAX_LEN) {
@ -165,6 +180,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 0..=MAX_LEN { LL | for i in 0..=MAX_LEN {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter().take(MAX_LEN + 1) { LL | for <item> in vec.iter().take(MAX_LEN + 1) {
@ -175,6 +191,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 5..10 { LL | for i in 5..10 {
| ^^^^^ | ^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter().take(10).skip(5) { LL | for <item> in vec.iter().take(10).skip(5) {
@ -185,6 +202,7 @@ error: the loop variable `i` is only used to index `vec`.
| |
LL | for i in 5..=10 { LL | for i in 5..=10 {
| ^^^^^^ | ^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for <item> in vec.iter().take(10 + 1).skip(5) { LL | for <item> in vec.iter().take(10 + 1).skip(5) {
@ -195,6 +213,7 @@ error: the loop variable `i` is used to index `vec`
| |
LL | for i in 5..vec.len() { LL | for i in 5..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for (i, <item>) in vec.iter().enumerate().skip(5) { LL | for (i, <item>) in vec.iter().enumerate().skip(5) {
@ -205,6 +224,7 @@ error: the loop variable `i` is used to index `vec`
| |
LL | for i in 5..10 { LL | for i in 5..10 {
| ^^^^^ | ^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) { LL | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
@ -215,6 +235,7 @@ error: the loop variable `i` is used to index `vec`
| |
LL | for i in 0..vec.len() { LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
|
help: consider using an iterator help: consider using an iterator
| |
LL | for (i, <item>) in vec.iter_mut().enumerate() { LL | for (i, <item>) in vec.iter_mut().enumerate() {

View File

@ -19,6 +19,7 @@ LL | / pub fn new() -> Self {
LL | | Bar LL | | Bar
LL | | } LL | | }
| |_____^ | |_____^
|
help: try this help: try this
| |
LL | #[derive(Default)] LL | #[derive(Default)]
@ -31,6 +32,7 @@ LL | / pub fn new() -> LtKo<'c> {
LL | | unimplemented!() LL | | unimplemented!()
LL | | } LL | | }
| |_____^ | |_____^
|
help: try this help: try this
| |
LL | impl Default for LtKo<'c> { LL | impl Default for LtKo<'c> {

View File

@ -14,6 +14,7 @@ LL | let _ = opt.map_or(None, |x| {
LL | | Some(x + 1) LL | | Some(x + 1)
LL | | }); LL | | });
| |_________________________^ | |_________________________^
|
help: try using and_then instead help: try using and_then instead
| |
LL | let _ = opt.and_then(|x| { LL | let _ = opt.and_then(|x| {

View File

@ -15,6 +15,7 @@ error: using `print!()` with a format string that ends in a single newline
| |
LL | print!("Hello {}/n", "world"); LL | print!("Hello {}/n", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `println!` instead help: use `println!` instead
| |
LL | println!("Hello {}", "world"); LL | println!("Hello {}", "world");
@ -25,6 +26,7 @@ error: using `print!()` with a format string that ends in a single newline
| |
LL | print!("Hello {} {}/n", "world", "#2"); LL | print!("Hello {} {}/n", "world", "#2");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `println!` instead help: use `println!` instead
| |
LL | println!("Hello {} {}", "world", "#2"); LL | println!("Hello {} {}", "world", "#2");
@ -35,6 +37,7 @@ error: using `print!()` with a format string that ends in a single newline
| |
LL | print!("{}/n", 1265); LL | print!("{}/n", 1265);
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
|
help: use `println!` instead help: use `println!` instead
| |
LL | println!("{}", 1265); LL | println!("{}", 1265);
@ -45,6 +48,7 @@ error: using `print!()` with a format string that ends in a single newline
| |
LL | print!("//n"); // should fail LL | print!("//n"); // should fail
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
|
help: use `println!` instead help: use `println!` instead
| |
LL | println!("/"); // should fail LL | println!("/"); // should fail
@ -58,6 +62,7 @@ LL | | "
LL | | " LL | | "
LL | | ); LL | | );
| |_____^ | |_____^
|
help: use `println!` instead help: use `println!` instead
| |
LL | println!( LL | println!(
@ -72,6 +77,7 @@ LL | | r"
LL | | " LL | | "
LL | | ); LL | | );
| |_____^ | |_____^
|
help: use `println!` instead help: use `println!` instead
| |
LL | println!( LL | println!(

View File

@ -23,6 +23,7 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and canno
| |
LL | fn cloned(x: &Vec<u8>) -> Vec<u8> { LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
| ^^^^^^^^ | ^^^^^^^^
|
help: change this to help: change this to
| |
LL | fn cloned(x: &[u8]) -> Vec<u8> { LL | fn cloned(x: &[u8]) -> Vec<u8> {
@ -41,6 +42,7 @@ error: writing `&String` instead of `&str` involves a new object where a slice w
| |
LL | fn str_cloned(x: &String) -> String { LL | fn str_cloned(x: &String) -> String {
| ^^^^^^^ | ^^^^^^^
|
help: change this to help: change this to
| |
LL | fn str_cloned(x: &str) -> String { LL | fn str_cloned(x: &str) -> String {
@ -63,6 +65,7 @@ error: writing `&String` instead of `&str` involves a new object where a slice w
| |
LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) { LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
| ^^^^^^^ | ^^^^^^^
|
help: change this to help: change this to
| |
LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) { LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) {

View File

@ -18,6 +18,7 @@ LL | foo({
LL | | 1; LL | | 1;
LL | | }); LL | | });
| |_____^ | |_____^
|
help: if you intended to pass a unit value, use a unit literal instead help: if you intended to pass a unit value, use a unit literal instead
| |
LL | foo(()); LL | foo(());
@ -28,6 +29,7 @@ error: passing a unit value to a function
| |
LL | foo(foo(1)); LL | foo(foo(1));
| ^^^^^^ | ^^^^^^
|
help: if you intended to pass a unit value, use a unit literal instead help: if you intended to pass a unit value, use a unit literal instead
| |
LL | foo(()); LL | foo(());
@ -42,6 +44,7 @@ LL | | foo(1);
LL | | foo(2); LL | | foo(2);
LL | | }); LL | | });
| |_____^ | |_____^
|
help: if you intended to pass a unit value, use a unit literal instead help: if you intended to pass a unit value, use a unit literal instead
| |
LL | foo(()); LL | foo(());
@ -52,6 +55,7 @@ error: passing a unit value to a function
| |
LL | foo3({}, 2, 2); LL | foo3({}, 2, 2);
| ^^ | ^^
|
help: if you intended to pass a unit value, use a unit literal instead help: if you intended to pass a unit value, use a unit literal instead
| |
LL | foo3((), 2, 2); LL | foo3((), 2, 2);
@ -65,6 +69,7 @@ LL | b.bar({
LL | | 1; LL | | 1;
LL | | }); LL | | });
| |_____^ | |_____^
|
help: if you intended to pass a unit value, use a unit literal instead help: if you intended to pass a unit value, use a unit literal instead
| |
LL | b.bar(()); LL | b.bar(());

View File

@ -15,6 +15,7 @@ error: using `write!()` with a format string that ends in a single newline
| |
LL | write!(&mut v, "Hello {}/n", "world"); LL | write!(&mut v, "Hello {}/n", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `writeln!()` instead help: use `writeln!()` instead
| |
LL | writeln!(&mut v, "Hello {}", "world"); LL | writeln!(&mut v, "Hello {}", "world");
@ -25,6 +26,7 @@ error: using `write!()` with a format string that ends in a single newline
| |
LL | write!(&mut v, "Hello {} {}/n", "world", "#2"); LL | write!(&mut v, "Hello {} {}/n", "world", "#2");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `writeln!()` instead help: use `writeln!()` instead
| |
LL | writeln!(&mut v, "Hello {} {}", "world", "#2"); LL | writeln!(&mut v, "Hello {} {}", "world", "#2");
@ -35,6 +37,7 @@ error: using `write!()` with a format string that ends in a single newline
| |
LL | write!(&mut v, "{}/n", 1265); LL | write!(&mut v, "{}/n", 1265);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `writeln!()` instead help: use `writeln!()` instead
| |
LL | writeln!(&mut v, "{}", 1265); LL | writeln!(&mut v, "{}", 1265);
@ -45,6 +48,7 @@ error: using `write!()` with a format string that ends in a single newline
| |
LL | write!(&mut v, "//n"); // should fail LL | write!(&mut v, "//n"); // should fail
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
|
help: use `writeln!()` instead help: use `writeln!()` instead
| |
LL | writeln!(&mut v, "/"); // should fail LL | writeln!(&mut v, "/"); // should fail
@ -59,6 +63,7 @@ LL | | "
LL | | " LL | | "
LL | | ); LL | | );
| |_____^ | |_____^
|
help: use `writeln!()` instead help: use `writeln!()` instead
| |
LL | writeln!( LL | writeln!(
@ -75,6 +80,7 @@ LL | | r"
LL | | " LL | | "
LL | | ); LL | | );
| |_____^ | |_____^
|
help: use `writeln!()` instead help: use `writeln!()` instead
| |
LL | writeln!( LL | writeln!(