diff --git a/tests/ui/block_in_if_condition.stderr b/tests/ui/block_in_if_condition.stderr index 34c0454b782..0876d5db696 100644 --- a/tests/ui/block_in_if_condition.stderr +++ b/tests/ui/block_in_if_condition.stderr @@ -31,7 +31,7 @@ LL | if { true } { } ... error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' - --> $DIR/block_in_if_condition.rs:57:17 + --> $DIR/block_in_if_condition.rs:58:17 | LL | |x| { | _________________^ @@ -41,7 +41,7 @@ LL | | }, | |_____________^ error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' - --> $DIR/block_in_if_condition.rs:66:13 + --> $DIR/block_in_if_condition.rs:67:13 | LL | |x| { | _____________^ @@ -51,7 +51,7 @@ LL | | }, | |_________^ error: this boolean expression can be simplified - --> $DIR/block_in_if_condition.rs:76:8 + --> $DIR/block_in_if_condition.rs:77:8 | LL | if true && x == 3 { | ^^^^^^^^^^^^^^ help: try: `x == 3` diff --git a/tests/ui/doc.stderr b/tests/ui/doc.stderr index 29fe1150b25..ae9bb394cb9 100644 --- a/tests/ui/doc.stderr +++ b/tests/ui/doc.stderr @@ -1,16 +1,10 @@ -error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> $DIR/doc.rs:1:29 - | -LL | //! This file tests for the DOC_MARKDOWN lint - | ^^^^^^^^^^^^ - | - = note: `-D clippy::doc-markdown` implied by `-D warnings` - error: you should put `foo_bar` between ticks in the documentation --> $DIR/doc.rs:8:9 | LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^ + | + = note: `-D clippy::doc-markdown` implied by `-D warnings` error: you should put `foo::bar` between ticks in the documentation --> $DIR/doc.rs:8:51 @@ -19,9 +13,9 @@ LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot t | ^^^^^^^^ error: you should put `Foo::some_fun` between ticks in the documentation - --> $DIR/doc.rs:9:84 + --> $DIR/doc.rs:9:83 | -LL | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun +LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun | ^^^^^^^^^^^^^ error: you should put `a::global:path` between ticks in the documentation @@ -115,10 +109,10 @@ LL | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:110:42 + --> $DIR/doc.rs:110:43 | -LL | /** E.g. serialization of an empty list: FooBar - | ^^^^^^ +LL | /** E.g., serialization of an empty list: FooBar + | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation --> $DIR/doc.rs:115:5 @@ -133,10 +127,10 @@ LL | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:121:42 + --> $DIR/doc.rs:121:43 | -LL | /** E.g. serialization of an empty list: FooBar - | ^^^^^^ +LL | /** E.g., serialization of an empty list: FooBar + | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation --> $DIR/doc.rs:126:5 @@ -186,5 +180,5 @@ error: you should put `mycrate::Collection` between ticks in the documentation LL | /// An iterator over mycrate::Collection's values. | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 31 previous errors +error: aborting due to 30 previous errors diff --git a/tests/ui/format.fixed b/tests/ui/format.fixed index 2200552430a..ab973e07511 100644 --- a/tests/ui/format.fixed +++ b/tests/ui/format.fixed @@ -6,51 +6,51 @@ struct Foo(pub String); macro_rules! foo { - ($($t:tt)*) => (Foo(format!($($t)*))) + ($($t:tt)*) => (Foo(format!($($t)*))) } fn main() { "foo".to_string(); "foo".to_string(); - format!("{:?}", "foo"); // don't warn about debug + format!("{:?}", "foo"); // Don't warn about `Debug`. format!("{:8}", "foo"); format!("{:width$}", "foo", width = 8); - "foo".to_string(); // warn when the format makes no difference - "foo".to_string(); // warn when the format makes no difference + "foo".to_string(); // Warn when the format makes no difference. + "foo".to_string(); // Warn when the format makes no difference. format!("foo {}", "bar"); format!("{} bar", "foo"); let arg: String = "".to_owned(); arg.to_string(); - format!("{:?}", arg); // don't warn about debug + format!("{:?}", arg); // Don't warn about debug. format!("{:8}", arg); format!("{:width$}", arg, width = 8); - arg.to_string(); // warn when the format makes no difference - arg.to_string(); // warn when the format makes no difference + arg.to_string(); // Warn when the format makes no difference. + arg.to_string(); // Warn when the format makes no difference. format!("foo {}", arg); format!("{} bar", arg); - // we don’t want to warn for non-string args, see #697 + // We don’t want to warn for non-string args; see issue #697. format!("{}", 42); format!("{:?}", 42); format!("{:+}", 42); format!("foo {}", 42); format!("{} bar", 42); - // we only want to warn about `format!` itself + // We only want to warn about `format!` itself. println!("foo"); println!("{}", "foo"); println!("foo {}", "foo"); println!("{}", 42); println!("foo {}", 42); - // A format! inside a macro should not trigger a warning + // A `format!` inside a macro should not trigger a warning. foo!("should not warn"); - // precision on string means slicing without panicking on size: - format!("{:.1}", "foo"); // could be "foo"[..1] - format!("{:.10}", "foo"); // could not be "foo"[..10] + // Precision on string means slicing without panicking on size. + format!("{:.1}", "foo"); // Could be `"foo"[..1]` + format!("{:.10}", "foo"); // Could not be `"foo"[..10]` format!("{:.prec$}", "foo", prec = 1); format!("{:.prec$}", "foo", prec = 10); diff --git a/tests/ui/format.stderr b/tests/ui/format.stderr index 236ac74b2e9..7ca63e2fea5 100644 --- a/tests/ui/format.stderr +++ b/tests/ui/format.stderr @@ -15,13 +15,13 @@ LL | format!("{}", "foo"); error: useless use of `format!` --> $DIR/format.rs:19:5 | -LL | format!("{:+}", "foo"); // warn when the format makes no difference +LL | format!("{:+}", "foo"); // Warn when the format makes no difference. | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();` error: useless use of `format!` --> $DIR/format.rs:20:5 | -LL | format!("{:<}", "foo"); // warn when the format makes no difference +LL | format!("{:<}", "foo"); // Warn when the format makes no difference. | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();` error: useless use of `format!` @@ -33,13 +33,13 @@ LL | format!("{}", arg); error: useless use of `format!` --> $DIR/format.rs:29:5 | -LL | format!("{:+}", arg); // warn when the format makes no difference +LL | format!("{:+}", arg); // Warn when the format makes no difference. | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();` error: useless use of `format!` --> $DIR/format.rs:30:5 | -LL | format!("{:<}", arg); // warn when the format makes no difference +LL | format!("{:<}", arg); // Warn when the format makes no difference. | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();` error: useless use of `format!` diff --git a/tests/ui/len_zero.stderr b/tests/ui/len_zero.stderr index a8b2e2e4097..f2ad0bb9e1e 100644 --- a/tests/ui/len_zero.stderr +++ b/tests/ui/len_zero.stderr @@ -19,7 +19,7 @@ LL | | } | |_^ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method - --> $DIR/len_zero.rs:89:1 + --> $DIR/len_zero.rs:90:1 | LL | / impl HasIsEmpty { LL | | pub fn len(self: &Self) -> isize { @@ -31,7 +31,7 @@ LL | | } | |_^ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:118:1 + --> $DIR/len_zero.rs:119:1 | LL | / impl HasWrongIsEmpty { LL | | pub fn len(self: &Self) -> isize { @@ -43,7 +43,7 @@ LL | | } | |_^ error: length comparison to zero - --> $DIR/len_zero.rs:139:8 + --> $DIR/len_zero.rs:140:8 | LL | if x.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `x.is_empty()` @@ -51,85 +51,85 @@ LL | if x.len() == 0 { = note: `-D clippy::len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:143:8 + --> $DIR/len_zero.rs:144:8 | LL | if "".len() == 0 {} | ^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `"".is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:158:8 + --> $DIR/len_zero.rs:159:8 | LL | if has_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:161:8 + --> $DIR/len_zero.rs:162:8 | LL | if has_is_empty.len() != 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:164:8 + --> $DIR/len_zero.rs:165:8 | LL | if has_is_empty.len() > 0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:167:8 + --> $DIR/len_zero.rs:168:8 | LL | if has_is_empty.len() < 1 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:170:8 + --> $DIR/len_zero.rs:171:8 | LL | if has_is_empty.len() >= 1 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:181:8 + --> $DIR/len_zero.rs:182:8 | LL | if 0 == has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:184:8 + --> $DIR/len_zero.rs:185:8 | LL | if 0 != has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:187:8 + --> $DIR/len_zero.rs:188:8 | LL | if 0 < has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:190:8 + --> $DIR/len_zero.rs:191:8 | LL | if 1 <= has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:193:8 + --> $DIR/len_zero.rs:194:8 | LL | if 1 > has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:207:8 + --> $DIR/len_zero.rs:208:8 | LL | if with_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `with_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:220:8 + --> $DIR/len_zero.rs:221:8 | LL | if b.len() != 0 {} | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!b.is_empty()` error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method - --> $DIR/len_zero.rs:226:1 + --> $DIR/len_zero.rs:227:1 | LL | / pub trait DependsOnFoo: Foo { LL | | fn len(&mut self) -> usize; diff --git a/tests/ui/lifetimes.stderr b/tests/ui/lifetimes.stderr index 18b8440089c..9eac0407e4d 100644 --- a/tests/ui/lifetimes.stderr +++ b/tests/ui/lifetimes.stderr @@ -13,7 +13,7 @@ LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:14:1 + --> $DIR/lifetimes.rs:16:1 | LL | / fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { LL | | x @@ -21,7 +21,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:38:1 + --> $DIR/lifetimes.rs:45:1 | LL | / fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { LL | | Ok(x) @@ -29,7 +29,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:43:1 + --> $DIR/lifetimes.rs:50:1 | LL | / fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> LL | | where @@ -40,13 +40,13 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:54:1 + --> $DIR/lifetimes.rs:62:1 | LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:75:1 + --> $DIR/lifetimes.rs:86:1 | LL | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> LL | | where @@ -57,7 +57,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:108:5 + --> $DIR/lifetimes.rs:120:5 | LL | / fn self_and_out<'s>(&'s self) -> &'s u8 { LL | | &self.x @@ -65,13 +65,13 @@ LL | | } | |_____^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:116:5 + --> $DIR/lifetimes.rs:129:5 | LL | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:132:1 + --> $DIR/lifetimes.rs:148:1 | LL | / fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { LL | | unimplemented!() @@ -79,7 +79,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:162:1 + --> $DIR/lifetimes.rs:178:1 | LL | / fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { LL | | unimplemented!() @@ -87,7 +87,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:168:1 + --> $DIR/lifetimes.rs:184:1 | LL | / fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { LL | | unimplemented!() @@ -95,7 +95,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:187:1 + --> $DIR/lifetimes.rs:203:1 | LL | / fn named_input_elided_output<'a>(_arg: &'a str) -> &str { LL | | unimplemented!() @@ -103,7 +103,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:195:1 + --> $DIR/lifetimes.rs:211:1 | LL | / fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { LL | | unimplemented!() @@ -111,7 +111,7 @@ LL | | } | |_^ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) - --> $DIR/lifetimes.rs:232:1 + --> $DIR/lifetimes.rs:247:1 | LL | / fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> { LL | | unimplemented!() diff --git a/tests/ui/methods.stderr b/tests/ui/methods.stderr index fb617c0cb26..cfbb0152eeb 100644 --- a/tests/ui/methods.stderr +++ b/tests/ui/methods.stderr @@ -9,7 +9,7 @@ LL | | } = note: `-D clippy::should-implement-trait` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/methods.rs:69:17 + --> $DIR/methods.rs:70:17 | LL | fn into_u16(&self) -> u16 { | ^^^^^ @@ -17,31 +17,31 @@ LL | fn into_u16(&self) -> u16 { = note: `-D clippy::wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/methods.rs:73:21 + --> $DIR/methods.rs:74:21 | LL | fn to_something(self) -> u32 { | ^^^^ error: methods called `new` usually take no self; consider choosing a less ambiguous name - --> $DIR/methods.rs:77:12 + --> $DIR/methods.rs:78:12 | LL | fn new(self) -> Self { | ^^^^ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:157:13 + --> $DIR/methods.rs:158:13 | LL | let _ = opt.map(|x| x + 1) | _____________^ -LL | | -LL | | .unwrap_or(0); // should lint even though this call is on a separate line +LL | | // Should lint even though this call is on a separate line. +LL | | .unwrap_or(0); | |____________________________^ | = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:161:13 + --> $DIR/methods.rs:162:13 | LL | let _ = opt.map(|x| { | _____________^ @@ -51,7 +51,7 @@ LL | | ).unwrap_or(0); | |____________________________^ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:165:13 + --> $DIR/methods.rs:166:13 | LL | let _ = opt.map(|x| x + 1) | _____________^ @@ -61,7 +61,7 @@ LL | | }); | |__________________^ error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:170:13 + --> $DIR/methods.rs:171:13 | LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))` error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:172:13 + --> $DIR/methods.rs:173:13 | LL | let _ = opt.map(|x| { | _____________^ @@ -79,7 +79,7 @@ LL | | ).unwrap_or(None); | |_____________________^ error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:176:13 + --> $DIR/methods.rs:177:13 | LL | let _ = opt | _____________^ @@ -90,7 +90,7 @@ LL | | .unwrap_or(None); = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:187:13 + --> $DIR/methods.rs:188:13 | LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -98,19 +98,19 @@ LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id); = note: replace `map(|p| format!("{}.", p)).unwrap_or(id)` with `map_or(id, |p| format!("{}.", p))` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:191:13 + --> $DIR/methods.rs:192:13 | LL | let _ = opt.map(|x| x + 1) | _____________^ -LL | | -LL | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line +LL | | // Should lint even though this call is on a separate line. +LL | | .unwrap_or_else(|| 0); | |____________________________________^ | = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:195:13 + --> $DIR/methods.rs:196:13 | LL | let _ = opt.map(|x| { | _____________^ @@ -120,7 +120,7 @@ LL | | ).unwrap_or_else(|| 0); | |____________________________________^ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:199:13 + --> $DIR/methods.rs:200:13 | LL | let _ = opt.map(|x| x + 1) | _____________^ @@ -130,7 +130,7 @@ LL | | ); | |_________________^ error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:208:13 + --> $DIR/methods.rs:210:13 | LL | let _ = opt.map_or(None, |x| Some(x + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))` @@ -138,7 +138,7 @@ LL | let _ = opt.map_or(None, |x| Some(x + 1)); = note: `-D clippy::option-map-or-none` implied by `-D warnings` error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:210:13 + --> $DIR/methods.rs:212:13 | LL | let _ = opt.map_or(None, |x| { | _____________^ @@ -154,7 +154,7 @@ LL | }); | error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:236:13 + --> $DIR/methods.rs:238:13 | LL | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -163,7 +163,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next(); = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:239:13 + --> $DIR/methods.rs:241:13 | LL | let _ = v.iter().filter(|&x| { | _____________^ @@ -173,7 +173,7 @@ LL | | ).next(); | |___________________________^ error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:255:13 + --> $DIR/methods.rs:257:13 | LL | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -182,7 +182,7 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some(); = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:258:13 + --> $DIR/methods.rs:260:13 | LL | let _ = v.iter().find(|&x| { | _____________^ @@ -192,7 +192,7 @@ LL | | ).is_some(); | |______________________________^ error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:264:13 + --> $DIR/methods.rs:266:13 | LL | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -200,7 +200,7 @@ LL | let _ = v.iter().position(|&x| x < 0).is_some(); = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:267:13 + --> $DIR/methods.rs:269:13 | LL | let _ = v.iter().position(|&x| { | _____________^ @@ -210,7 +210,7 @@ LL | | ).is_some(); | |______________________________^ error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:273:13 + --> $DIR/methods.rs:275:13 | LL | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -218,7 +218,7 @@ LL | let _ = v.iter().rposition(|&x| x < 0).is_some(); = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:276:13 + --> $DIR/methods.rs:278:13 | LL | let _ = v.iter().rposition(|&x| { | _____________^ @@ -228,7 +228,7 @@ LL | | ).is_some(); | |______________________________^ error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:313:22 + --> $DIR/methods.rs:315:22 | LL | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)` @@ -236,73 +236,73 @@ LL | with_constructor.unwrap_or(make()); = note: `-D clippy::or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` - --> $DIR/methods.rs:316:5 + --> $DIR/methods.rs:318:5 | LL | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:319:21 + --> $DIR/methods.rs:321:21 | LL | with_const_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:322:14 + --> $DIR/methods.rs:324:14 | LL | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:325:19 + --> $DIR/methods.rs:327:19 | LL | with_err_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:328:5 + --> $DIR/methods.rs:330:5 | LL | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:331:5 + --> $DIR/methods.rs:333:5 | LL | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:334:14 + --> $DIR/methods.rs:336:14 | LL | with_vec.unwrap_or(vec![]); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:339:21 + --> $DIR/methods.rs:341:21 | LL | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:342:19 + --> $DIR/methods.rs:344:19 | LL | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:345:21 + --> $DIR/methods.rs:347:21 | LL | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:348:21 + --> $DIR/methods.rs:350:21 | LL | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:359:23 + --> $DIR/methods.rs:361:23 | LL | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -310,43 +310,43 @@ LL | let bad_vec = some_vec.iter().nth(3); = note: `-D clippy::iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:360:26 + --> $DIR/methods.rs:362:26 | LL | let bad_slice = &some_vec[..].iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:361:31 + --> $DIR/methods.rs:363:31 | LL | let bad_boxed_slice = boxed_slice.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:362:29 + --> $DIR/methods.rs:364:29 | LL | let bad_vec_deque = some_vec_deque.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:367:23 + --> $DIR/methods.rs:369:23 | LL | let bad_vec = some_vec.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:370:26 + --> $DIR/methods.rs:372:26 | LL | let bad_slice = &some_vec[..].iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:373:29 + --> $DIR/methods.rs:375:29 | LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message - --> $DIR/methods.rs:385:13 + --> $DIR/methods.rs:387:13 | LL | let _ = opt.unwrap(); | ^^^^^^^^^^^^