From 4a52dd6c532c266048b1de8d0a863e72d33c36f0 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sat, 26 Oct 2019 21:53:42 +0200 Subject: [PATCH] Rustup to rust-lang/rust#65773 --- tests/ui/assign_ops2.stderr | 8 ++++++++ tests/ui/booleans.stderr | 3 +++ tests/ui/collapsible_if.stderr | 13 +++++++++++++ tests/ui/dbg_macro.stderr | 6 ++++++ tests/ui/for_kv_map.stderr | 4 ++++ tests/ui/for_loop_fixable.stderr | 4 ++++ tests/ui/implicit_hasher.stderr | 9 +++++++++ tests/ui/large_enum_variant.stderr | 2 ++ tests/ui/let_return.stderr | 1 + tests/ui/let_unit.stderr | 1 + tests/ui/literals.stderr | 1 + tests/ui/manual_memcpy.stderr | 1 + tests/ui/match_bool.stderr | 4 ++++ tests/ui/match_ref_pats.stderr | 5 +++++ tests/ui/needless_pass_by_value.stderr | 2 ++ tests/ui/needless_range_loop.stderr | 21 +++++++++++++++++++++ tests/ui/new_without_default.stderr | 2 ++ tests/ui/option_map_or_none.stderr | 1 + tests/ui/print_with_newline.stderr | 6 ++++++ tests/ui/ptr_arg.stderr | 3 +++ tests/ui/unit_arg.stderr | 5 +++++ tests/ui/write_with_newline.stderr | 6 ++++++ 22 files changed, 108 insertions(+) diff --git a/tests/ui/assign_ops2.stderr b/tests/ui/assign_ops2.stderr index 872d6e0d7347..c746cfd9d56b 100644 --- a/tests/ui/assign_ops2.stderr +++ b/tests/ui/assign_ops2.stderr @@ -19,6 +19,7 @@ error: variable appears on both sides of an assignment operation | LL | a += 1 + a; | ^^^^^^^^^^ + | help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with | LL | a += 1; @@ -33,6 +34,7 @@ error: variable appears on both sides of an assignment operation | LL | a -= a - 1; | ^^^^^^^^^^ + | help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with | LL | a -= 1; @@ -47,6 +49,7 @@ error: variable appears on both sides of an assignment operation | LL | a *= a * 99; | ^^^^^^^^^^^ + | help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with | LL | a *= 99; @@ -61,6 +64,7 @@ error: variable appears on both sides of an assignment operation | LL | a *= 42 * a; | ^^^^^^^^^^^ + | help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with | LL | a *= 42; @@ -75,6 +79,7 @@ error: variable appears on both sides of an assignment operation | LL | a /= a / 2; | ^^^^^^^^^^ + | help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with | LL | a /= 2; @@ -89,6 +94,7 @@ error: variable appears on both sides of an assignment operation | LL | a %= a % 5; | ^^^^^^^^^^ + | help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with | LL | a %= 5; @@ -103,6 +109,7 @@ error: variable appears on both sides of an assignment operation | LL | a &= a & 1; | ^^^^^^^^^^ + | help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with | LL | a &= 1; @@ -117,6 +124,7 @@ error: variable appears on both sides of an assignment operation | LL | a *= a * a; | ^^^^^^^^^^ + | help: Did you mean a = a * a or a = a * a * a? Consider replacing it with | LL | a *= a; diff --git a/tests/ui/booleans.stderr b/tests/ui/booleans.stderr index ab0b54e26d70..b83df6f81385 100644 --- a/tests/ui/booleans.stderr +++ b/tests/ui/booleans.stderr @@ -72,6 +72,7 @@ error: this boolean expression can be simplified | LL | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: try | 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; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: try | 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); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: try | LL | let _ = c != d || a != b; diff --git a/tests/ui/collapsible_if.stderr b/tests/ui/collapsible_if.stderr index d6d0b9d5d4ea..16bc5a1c1b02 100644 --- a/tests/ui/collapsible_if.stderr +++ b/tests/ui/collapsible_if.stderr @@ -25,6 +25,7 @@ LL | | println!("Hello world!"); LL | | } LL | | } | |_____^ + | help: try | LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { @@ -41,6 +42,7 @@ LL | | println!("Hello world!"); LL | | } LL | | } | |_____^ + | help: try | LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") { @@ -57,6 +59,7 @@ LL | | println!("Hello world!"); LL | | } LL | | } | |_____^ + | help: try | LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" { @@ -73,6 +76,7 @@ LL | | println!("Hello world!"); LL | | } LL | | } | |_____^ + | help: try | LL | if x == "hello" && x == "world" && y == "world" && y == "hello" { @@ -89,6 +93,7 @@ LL | | println!("world!") LL | | } LL | | } | |_____^ + | help: try | LL | if 42 == 1337 && 'a' != 'A' { @@ -106,6 +111,7 @@ LL | | println!("world!") LL | | } LL | | } | |_____^ + | help: try | LL | } else if y == "world" { @@ -123,6 +129,7 @@ LL | | println!("world!") LL | | } LL | | } | |_____^ + | help: try | LL | } else if let Some(42) = Some(42) { @@ -142,6 +149,7 @@ LL | | } LL | | } LL | | } | |_____^ + | help: try | LL | } else if y == "world" { @@ -164,6 +172,7 @@ LL | | } LL | | } LL | | } | |_____^ + | help: try | LL | } else if let Some(42) = Some(42) { @@ -186,6 +195,7 @@ LL | | } LL | | } LL | | } | |_____^ + | help: try | LL | } else if let Some(42) = Some(42) { @@ -208,6 +218,7 @@ LL | | } LL | | } LL | | } | |_____^ + | help: try | LL | } else if x == "hello" { @@ -230,6 +241,7 @@ LL | | } LL | | } LL | | } | |_____^ + | help: try | LL | } else if let Some(42) = Some(42) { @@ -249,6 +261,7 @@ LL | | println!("Hello world!"); LL | | } LL | | } | |_____^ + | help: try | LL | if x == "hello" && y == "world" { // Collapsible diff --git a/tests/ui/dbg_macro.stderr b/tests/ui/dbg_macro.stderr index 43a60180f964..b8aafe966784 100644 --- a/tests/ui/dbg_macro.stderr +++ b/tests/ui/dbg_macro.stderr @@ -15,6 +15,7 @@ error: `dbg!` macro is intended as a debugging tool | LL | if dbg!(n <= 1) { | ^^^^^^^^^^^^ + | help: ensure to avoid having uses of it in version control | LL | if n <= 1 { @@ -25,6 +26,7 @@ error: `dbg!` macro is intended as a debugging tool | LL | dbg!(1) | ^^^^^^^ + | help: ensure to avoid having uses of it in version control | LL | 1 @@ -35,6 +37,7 @@ error: `dbg!` macro is intended as a debugging tool | LL | dbg!(n * factorial(n - 1)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: ensure to avoid having uses of it in version control | LL | n * factorial(n - 1) @@ -45,6 +48,7 @@ error: `dbg!` macro is intended as a debugging tool | LL | dbg!(42); | ^^^^^^^^ + | help: ensure to avoid having uses of it in version control | LL | 42; @@ -55,6 +59,7 @@ error: `dbg!` macro is intended as a debugging tool | LL | dbg!(dbg!(dbg!(42))); | ^^^^^^^^^^^^^^^^^^^^ + | help: ensure to avoid having uses of it in version control | LL | dbg!(dbg!(42)); @@ -65,6 +70,7 @@ error: `dbg!` macro is intended as a debugging tool | LL | foo(3) + dbg!(factorial(4)); | ^^^^^^^^^^^^^^^^^^ + | help: ensure to avoid having uses of it in version control | LL | foo(3) + factorial(4); diff --git a/tests/ui/for_kv_map.stderr b/tests/ui/for_kv_map.stderr index ebe758526ec9..241758c542cf 100644 --- a/tests/ui/for_kv_map.stderr +++ b/tests/ui/for_kv_map.stderr @@ -15,6 +15,7 @@ error: you seem to want to iterate on a map's values | LL | for (_, v) in &*m { | ^^^ + | help: use the corresponding method | 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 { | ^^^^^^ + | help: use the corresponding method | 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 { | ^^^^^^^ + | help: use the corresponding method | 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 { | ^^ + | help: use the corresponding method | LL | for k in rm.keys() { diff --git a/tests/ui/for_loop_fixable.stderr b/tests/ui/for_loop_fixable.stderr index 6d6fa3ac7af9..7454f40f3e2d 100644 --- a/tests/ui/for_loop_fixable.stderr +++ b/tests/ui/for_loop_fixable.stderr @@ -15,6 +15,7 @@ error: this range is empty so this for loop will never run | LL | for i in 10..=0 { | ^^^^^^ + | help: consider using the following if you are attempting to iterate over this range in reverse | 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 { | ^^^^^^^^^^ + | help: consider using the following if you are attempting to iterate over this range in reverse | 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 { | ^^^^^^^^^ + | help: consider using the following if you are attempting to iterate over this range in reverse | 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) { | ^^^^^^^^^^^^^^^^ + | 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() { diff --git a/tests/ui/implicit_hasher.stderr b/tests/ui/implicit_hasher.stderr index a3bc08afd560..b73d9716adc7 100644 --- a/tests/ui/implicit_hasher.stderr +++ b/tests/ui/implicit_hasher.stderr @@ -19,6 +19,7 @@ error: impl for `HashMap` should be generalized over different hashers | LL | impl Foo for (HashMap,) { | ^^^^^^^^^^^^^ + | help: consider adding a type parameter | LL | impl Foo for (HashMap,) { @@ -33,6 +34,7 @@ error: impl for `HashMap` should be generalized over different hashers | LL | impl Foo for HashMap { | ^^^^^^^^^^^^^^^^^^^^^^^ + | help: consider adding a type parameter | LL | impl Foo for HashMap { @@ -47,6 +49,7 @@ error: impl for `HashSet` should be generalized over different hashers | LL | impl Foo for HashSet { | ^^^^^^^^^^ + | help: consider adding a type parameter | LL | impl Foo for HashSet { @@ -61,6 +64,7 @@ error: impl for `HashSet` should be generalized over different hashers | LL | impl Foo for HashSet { | ^^^^^^^^^^^^^^^ + | help: consider adding a type parameter | LL | impl Foo for HashSet { @@ -75,6 +79,7 @@ error: parameter of type `HashMap` should be generalized over different hashers | LL | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) {} | ^^^^^^^^^^^^^^^^^ + | help: consider adding a type parameter | LL | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) {} @@ -85,6 +90,7 @@ error: parameter of type `HashSet` should be generalized over different hashers | LL | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) {} | ^^^^^^^^^^^^ + | help: consider adding a type parameter | LL | pub fn foo(_map: &mut HashMap, _set: &mut HashSet) {} @@ -98,6 +104,7 @@ LL | impl Foo for HashMap { ... LL | gen!(impl); | ----------- in this macro invocation + | help: consider adding a type parameter | LL | impl Foo for HashMap { @@ -115,6 +122,7 @@ LL | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) ... LL | gen!(fn bar); | ------------- in this macro invocation + | help: consider adding a type parameter | LL | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) {} @@ -128,6 +136,7 @@ LL | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) ... LL | gen!(fn bar); | ------------- in this macro invocation + | help: consider adding a type parameter | LL | pub fn $name(_map: &mut HashMap, _set: &mut HashSet) {} diff --git a/tests/ui/large_enum_variant.stderr b/tests/ui/large_enum_variant.stderr index b13812612cb8..d3c41ef3c6f3 100644 --- a/tests/ui/large_enum_variant.stderr +++ b/tests/ui/large_enum_variant.stderr @@ -27,6 +27,7 @@ error: large size difference between variants | LL | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: consider boxing the large fields to reduce the total size of the enum | LL | ContainingLargeEnum(Box), @@ -61,6 +62,7 @@ error: large size difference between variants | LL | StructLikeLarge2 { x: [i32; 8000] }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: consider boxing the large fields to reduce the total size of the enum | LL | StructLikeLarge2 { x: Box<[i32; 8000]> }, diff --git a/tests/ui/let_return.stderr b/tests/ui/let_return.stderr index 319f45c0a8a0..11e9681f3ec0 100644 --- a/tests/ui/let_return.stderr +++ b/tests/ui/let_return.stderr @@ -20,6 +20,7 @@ LL | let x = 5; | ---------- unnecessary let binding LL | x | ^ + | help: return the expression directly | LL | diff --git a/tests/ui/let_unit.stderr b/tests/ui/let_unit.stderr index 7130fcd870e3..eb8482087bcc 100644 --- a/tests/ui/let_unit.stderr +++ b/tests/ui/let_unit.stderr @@ -23,6 +23,7 @@ LL | | .map(|_| ()) LL | | .next() LL | | .unwrap(); | |__________________^ + | help: omit the `let` binding | LL | v diff --git a/tests/ui/literals.stderr b/tests/ui/literals.stderr index 4e1e8e4c246a..9a6388394cd0 100644 --- a/tests/ui/literals.stderr +++ b/tests/ui/literals.stderr @@ -39,6 +39,7 @@ error: this is a decimal constant | LL | let fail8 = 0123; | ^^^^ + | help: if you mean to use a decimal constant, remove the `0` to avoid confusion | LL | let fail8 = 123; diff --git a/tests/ui/manual_memcpy.stderr b/tests/ui/manual_memcpy.stderr index 49ab83f2dd2a..3dbb2155d4de 100644 --- a/tests/ui/manual_memcpy.stderr +++ b/tests/ui/manual_memcpy.stderr @@ -35,6 +35,7 @@ error: it looks like you're manually copying between slices | LL | for i in 10..256 { | ^^^^^^^ + | help: try replacing the loop by | LL | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]) diff --git a/tests/ui/match_bool.stderr b/tests/ui/match_bool.stderr index 5c65d2fed3da..2751048f8726 100644 --- a/tests/ui/match_bool.stderr +++ b/tests/ui/match_bool.stderr @@ -36,6 +36,7 @@ LL | | println!("Noooo!"); LL | | }, LL | | }; | |_____^ + | help: consider using an if/else expression | LL | if !test { @@ -53,6 +54,7 @@ LL | | }, LL | | _ => (), LL | | }; | |_____^ + | help: consider using an if/else expression | LL | if !test { @@ -70,6 +72,7 @@ LL | | }, LL | | _ => (), LL | | }; | |_____^ + | help: consider using an if/else expression | LL | if !(test && test) { @@ -96,6 +99,7 @@ LL | | }, LL | | }, LL | | }; | |_____^ + | help: consider using an if/else expression | LL | if test { diff --git a/tests/ui/match_ref_pats.stderr b/tests/ui/match_ref_pats.stderr index 80e862c8ea9e..492f4b9ba206 100644 --- a/tests/ui/match_ref_pats.stderr +++ b/tests/ui/match_ref_pats.stderr @@ -23,6 +23,7 @@ LL | | &(v, 1) => println!("{}", v), LL | | _ => println!("none"), LL | | } | |_____^ + | help: instead of prefixing all patterns with `&`, you can dereference the expression | LL | match *tup { @@ -37,6 +38,7 @@ LL | | &Some(v) => println!("{:?}", v), LL | | &None => println!("none"), LL | | } | |_____^ + | help: try | LL | match w { @@ -51,6 +53,7 @@ LL | / if let &None = a { LL | | println!("none"); LL | | } | |_____^ + | help: instead of prefixing all patterns with `&`, you can dereference the expression | LL | if let None = *a { @@ -63,6 +66,7 @@ LL | / if let &None = &b { LL | | println!("none"); LL | | } | |_____^ + | help: try | LL | if let None = b { @@ -76,6 +80,7 @@ LL | | &Foo::A => println!("A"), LL | | _ => println!("Wild"), LL | | } | |_________^ + | help: instead of prefixing all patterns with `&`, you can dereference the expression | LL | match *foo_variant!(0) { diff --git a/tests/ui/needless_pass_by_value.stderr b/tests/ui/needless_pass_by_value.stderr index 3cb64a227f1a..6cf517c22efb 100644 --- a/tests/ui/needless_pass_by_value.stderr +++ b/tests/ui/needless_pass_by_value.stderr @@ -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, v: Vec) { | ^^^^^^ + | help: consider changing the type to | LL | fn issue_2114(s: String, t: &str, u: Vec, v: Vec) { @@ -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, v: Vec) { | ^^^^^^^^ + | help: consider changing the type to | LL | fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) { diff --git a/tests/ui/needless_range_loop.stderr b/tests/ui/needless_range_loop.stderr index 4df07c6f1e52..f145c11dbc28 100644 --- a/tests/ui/needless_range_loop.stderr +++ b/tests/ui/needless_range_loop.stderr @@ -15,6 +15,7 @@ error: the loop variable `i` is only used to index `ms`. | LL | for i in 0..ms.len() { | ^^^^^^^^^^^ + | help: consider using an iterator | LL | for 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() { | ^^^^^^^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^ + | help: consider using an iterator | LL | for in &arr { @@ -65,6 +70,7 @@ error: the loop variable `i` is only used to index `arr`. | LL | for i in 0..2 { | ^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^ + | help: consider using an iterator | LL | for 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() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for in &vec { @@ -95,6 +103,7 @@ error: the loop variable `i` is only used to index `vec`. | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for in &vec { @@ -105,6 +114,7 @@ error: the loop variable `j` is only used to index `STATIC`. | LL | for j in 0..4 { | ^^^^ + | help: consider using an iterator | LL | for in &STATIC { @@ -115,6 +125,7 @@ error: the loop variable `j` is only used to index `CONST`. | LL | for j in 0..4 { | ^^^^ + | help: consider using an iterator | LL | for in &CONST { @@ -125,6 +136,7 @@ error: the loop variable `i` is used to index `vec` | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for (i, ) 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() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for 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() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^^^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^^^^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^^ + | help: consider using an iterator | LL | for 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 { | ^^^^^^ + | help: consider using an iterator | LL | for 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() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for (i, ) 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 { | ^^^^^ + | help: consider using an iterator | LL | for (i, ) 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() { | ^^^^^^^^^^^^ + | help: consider using an iterator | LL | for (i, ) in vec.iter_mut().enumerate() { diff --git a/tests/ui/new_without_default.stderr b/tests/ui/new_without_default.stderr index cd8e2837f080..5e485d40663f 100644 --- a/tests/ui/new_without_default.stderr +++ b/tests/ui/new_without_default.stderr @@ -19,6 +19,7 @@ LL | / pub fn new() -> Self { LL | | Bar LL | | } | |_____^ + | help: try this | LL | #[derive(Default)] @@ -31,6 +32,7 @@ LL | / pub fn new() -> LtKo<'c> { LL | | unimplemented!() LL | | } | |_____^ + | help: try this | LL | impl Default for LtKo<'c> { diff --git a/tests/ui/option_map_or_none.stderr b/tests/ui/option_map_or_none.stderr index eb5c68ed79f3..857b33a4291d 100644 --- a/tests/ui/option_map_or_none.stderr +++ b/tests/ui/option_map_or_none.stderr @@ -14,6 +14,7 @@ LL | let _ = opt.map_or(None, |x| { LL | | Some(x + 1) LL | | }); | |_________________________^ + | help: try using and_then instead | LL | let _ = opt.and_then(|x| { diff --git a/tests/ui/print_with_newline.stderr b/tests/ui/print_with_newline.stderr index 81e8b45b5660..c9e37eab6e1b 100644 --- a/tests/ui/print_with_newline.stderr +++ b/tests/ui/print_with_newline.stderr @@ -15,6 +15,7 @@ error: using `print!()` with a format string that ends in a single newline | LL | print!("Hello {}/n", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: use `println!` instead | 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"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: use `println!` instead | 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); | ^^^^^^^^^^^^^^^^^^^^ + | help: use `println!` instead | 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 | ^^^^^^^^^^^^^^ + | help: use `println!` instead | LL | println!("/"); // should fail @@ -58,6 +62,7 @@ LL | | " LL | | " LL | | ); | |_____^ + | help: use `println!` instead | LL | println!( @@ -72,6 +77,7 @@ LL | | r" LL | | " LL | | ); | |_____^ + | help: use `println!` instead | LL | println!( diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr index 34516368e5e4..314f23497f97 100644 --- a/tests/ui/ptr_arg.stderr +++ b/tests/ui/ptr_arg.stderr @@ -23,6 +23,7 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and canno | LL | fn cloned(x: &Vec) -> Vec { | ^^^^^^^^ + | help: change this to | LL | fn cloned(x: &[u8]) -> Vec { @@ -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 { | ^^^^^^^ + | help: change this to | 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, y: &String) { | ^^^^^^^ + | help: change this to | LL | fn false_positive_capacity(x: &Vec, y: &str) { diff --git a/tests/ui/unit_arg.stderr b/tests/ui/unit_arg.stderr index 862534b18ecb..21ccc684ea9d 100644 --- a/tests/ui/unit_arg.stderr +++ b/tests/ui/unit_arg.stderr @@ -18,6 +18,7 @@ LL | foo({ LL | | 1; LL | | }); | |_____^ + | help: if you intended to pass a unit value, use a unit literal instead | LL | foo(()); @@ -28,6 +29,7 @@ error: passing a unit value to a function | LL | foo(foo(1)); | ^^^^^^ + | help: if you intended to pass a unit value, use a unit literal instead | LL | foo(()); @@ -42,6 +44,7 @@ LL | | foo(1); LL | | foo(2); LL | | }); | |_____^ + | help: if you intended to pass a unit value, use a unit literal instead | LL | foo(()); @@ -52,6 +55,7 @@ error: passing a unit value to a function | LL | foo3({}, 2, 2); | ^^ + | help: if you intended to pass a unit value, use a unit literal instead | LL | foo3((), 2, 2); @@ -65,6 +69,7 @@ LL | b.bar({ LL | | 1; LL | | }); | |_____^ + | help: if you intended to pass a unit value, use a unit literal instead | LL | b.bar(()); diff --git a/tests/ui/write_with_newline.stderr b/tests/ui/write_with_newline.stderr index c1f1d64c2e32..4d95bfeb17f4 100644 --- a/tests/ui/write_with_newline.stderr +++ b/tests/ui/write_with_newline.stderr @@ -15,6 +15,7 @@ error: using `write!()` with a format string that ends in a single newline | LL | write!(&mut v, "Hello {}/n", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: use `writeln!()` instead | 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"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: use `writeln!()` instead | 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); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: use `writeln!()` instead | 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 | ^^^^^^^^^^^^^^^^^^^^^^ + | help: use `writeln!()` instead | LL | writeln!(&mut v, "/"); // should fail @@ -59,6 +63,7 @@ LL | | " LL | | " LL | | ); | |_____^ + | help: use `writeln!()` instead | LL | writeln!( @@ -75,6 +80,7 @@ LL | | r" LL | | " LL | | ); | |_____^ + | help: use `writeln!()` instead | LL | writeln!(