diff --git a/tests/ui/cognitive_complexity.rs b/tests/ui/cognitive_complexity.rs index a1f1c586eb0b..b06b234177b3 100644 --- a/tests/ui/cognitive_complexity.rs +++ b/tests/ui/cognitive_complexity.rs @@ -1,6 +1,7 @@ #![allow(clippy::all)] #![warn(clippy::cognitive_complexity)] #![allow(unused)] +#![allow(deprecated)] // for deprecated `try` macro #[rustfmt::skip] fn main() { diff --git a/tests/ui/cognitive_complexity.stderr b/tests/ui/cognitive_complexity.stderr index e1c5863f4942..581f19705fb8 100644 --- a/tests/ui/cognitive_complexity.stderr +++ b/tests/ui/cognitive_complexity.stderr @@ -1,5 +1,5 @@ error: the function has a cognitive complexity of 28 - --> $DIR/cognitive_complexity.rs:6:1 + --> $DIR/cognitive_complexity.rs:7:1 | LL | / fn main() { LL | | if true { @@ -14,7 +14,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 7 - --> $DIR/cognitive_complexity.rs:91:1 + --> $DIR/cognitive_complexity.rs:92:1 | LL | / fn kaboom() { LL | | let n = 0; @@ -28,7 +28,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 1 - --> $DIR/cognitive_complexity.rs:137:1 + --> $DIR/cognitive_complexity.rs:138:1 | LL | / fn lots_of_short_circuits() -> bool { LL | | true && false && true && false && true && false && true @@ -38,7 +38,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 1 - --> $DIR/cognitive_complexity.rs:142:1 + --> $DIR/cognitive_complexity.rs:143:1 | LL | / fn lots_of_short_circuits2() -> bool { LL | | true || false || true || false || true || false || true @@ -48,7 +48,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:147:1 + --> $DIR/cognitive_complexity.rs:148:1 | LL | / fn baa() { LL | | let x = || match 99 { @@ -62,7 +62,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:148:13 + --> $DIR/cognitive_complexity.rs:149:13 | LL | let x = || match 99 { | _____________^ @@ -77,7 +77,7 @@ LL | | }; = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:165:1 + --> $DIR/cognitive_complexity.rs:166:1 | LL | / fn bar() { LL | | match 99 { @@ -90,7 +90,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:184:1 + --> $DIR/cognitive_complexity.rs:185:1 | LL | / fn barr() { LL | | match 99 { @@ -104,7 +104,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 3 - --> $DIR/cognitive_complexity.rs:194:1 + --> $DIR/cognitive_complexity.rs:195:1 | LL | / fn barr2() { LL | | match 99 { @@ -118,7 +118,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:210:1 + --> $DIR/cognitive_complexity.rs:211:1 | LL | / fn barrr() { LL | | match 99 { @@ -132,7 +132,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 3 - --> $DIR/cognitive_complexity.rs:220:1 + --> $DIR/cognitive_complexity.rs:221:1 | LL | / fn barrr2() { LL | | match 99 { @@ -146,7 +146,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:236:1 + --> $DIR/cognitive_complexity.rs:237:1 | LL | / fn barrrr() { LL | | match 99 { @@ -160,7 +160,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 3 - --> $DIR/cognitive_complexity.rs:246:1 + --> $DIR/cognitive_complexity.rs:247:1 | LL | / fn barrrr2() { LL | | match 99 { @@ -174,7 +174,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 2 - --> $DIR/cognitive_complexity.rs:262:1 + --> $DIR/cognitive_complexity.rs:263:1 | LL | / fn cake() { LL | | if 4 == 5 { @@ -188,7 +188,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 4 - --> $DIR/cognitive_complexity.rs:272:1 + --> $DIR/cognitive_complexity.rs:273:1 | LL | / pub fn read_file(input_path: &str) -> String { LL | | use std::fs::File; @@ -202,7 +202,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 1 - --> $DIR/cognitive_complexity.rs:303:1 + --> $DIR/cognitive_complexity.rs:304:1 | LL | / fn void(void: Void) { LL | | if true { @@ -214,7 +214,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 1 - --> $DIR/cognitive_complexity.rs:316:1 + --> $DIR/cognitive_complexity.rs:317:1 | LL | / fn try_() -> Result { LL | | match 5 { @@ -227,7 +227,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 1 - --> $DIR/cognitive_complexity.rs:324:1 + --> $DIR/cognitive_complexity.rs:325:1 | LL | / fn try_again() -> Result { LL | | let _ = r#try!(Ok(42)); @@ -241,7 +241,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 1 - --> $DIR/cognitive_complexity.rs:340:1 + --> $DIR/cognitive_complexity.rs:341:1 | LL | / fn early() -> Result { LL | | return Ok(5); @@ -255,7 +255,7 @@ LL | | } = help: you could split it up into multiple smaller functions error: the function has a cognitive complexity of 8 - --> $DIR/cognitive_complexity.rs:354:1 + --> $DIR/cognitive_complexity.rs:355:1 | LL | / fn early_ret() -> i32 { LL | | let a = if true { 42 } else { return 0; }; diff --git a/tests/ui/if_same_then_else.rs b/tests/ui/if_same_then_else.rs index f9923c9bb480..8994148b4fde 100644 --- a/tests/ui/if_same_then_else.rs +++ b/tests/ui/if_same_then_else.rs @@ -10,6 +10,7 @@ clippy::zero_divided_by_zero, clippy::unused_unit )] +#![allow(deprecated)] // for `try` macro struct Foo { bar: u8, diff --git a/tests/ui/if_same_then_else.stderr b/tests/ui/if_same_then_else.stderr index 9649c2232932..44a84b818758 100644 --- a/tests/ui/if_same_then_else.stderr +++ b/tests/ui/if_same_then_else.stderr @@ -1,5 +1,5 @@ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:31:12 + --> $DIR/if_same_then_else.rs:32:12 | LL | } else { | ____________^ @@ -13,7 +13,7 @@ LL | | } | = note: `-D clippy::if-same-then-else` implied by `-D warnings` note: same as this - --> $DIR/if_same_then_else.rs:23:13 + --> $DIR/if_same_then_else.rs:24:13 | LL | if true { | _____________^ @@ -26,7 +26,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:69:12 + --> $DIR/if_same_then_else.rs:70:12 | LL | } else { | ____________^ @@ -36,7 +36,7 @@ LL | | }; | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:67:21 + --> $DIR/if_same_then_else.rs:68:21 | LL | let _ = if true { | _____________________^ @@ -45,7 +45,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:76:12 + --> $DIR/if_same_then_else.rs:77:12 | LL | } else { | ____________^ @@ -55,7 +55,7 @@ LL | | }; | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:74:21 + --> $DIR/if_same_then_else.rs:75:21 | LL | let _ = if true { | _____________________^ @@ -64,7 +64,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:92:12 + --> $DIR/if_same_then_else.rs:93:12 | LL | } else { | ____________^ @@ -74,7 +74,7 @@ LL | | }; | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:90:21 + --> $DIR/if_same_then_else.rs:91:21 | LL | let _ = if true { | _____________________^ @@ -83,7 +83,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:106:12 + --> $DIR/if_same_then_else.rs:107:12 | LL | } else { | ____________^ @@ -96,7 +96,7 @@ LL | | } | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:97:13 + --> $DIR/if_same_then_else.rs:98:13 | LL | if true { | _____________^ @@ -109,7 +109,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:125:12 + --> $DIR/if_same_then_else.rs:126:12 | LL | } else { | ____________^ @@ -122,7 +122,7 @@ LL | | } | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:118:13 + --> $DIR/if_same_then_else.rs:119:13 | LL | if true { | _____________^ @@ -135,7 +135,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:155:12 + --> $DIR/if_same_then_else.rs:156:12 | LL | } else { | ____________^ @@ -145,7 +145,7 @@ LL | | } | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:153:13 + --> $DIR/if_same_then_else.rs:154:13 | LL | if true { | _____________^ @@ -154,7 +154,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:162:12 + --> $DIR/if_same_then_else.rs:163:12 | LL | } else { | ____________^ @@ -164,7 +164,7 @@ LL | | } | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:160:13 + --> $DIR/if_same_then_else.rs:161:13 | LL | if true { | _____________^ @@ -173,7 +173,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:212:12 + --> $DIR/if_same_then_else.rs:213:12 | LL | } else { | ____________^ @@ -183,7 +183,7 @@ LL | | }; | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:210:21 + --> $DIR/if_same_then_else.rs:211:21 | LL | let _ = if true { | _____________________^ @@ -192,7 +192,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:219:12 + --> $DIR/if_same_then_else.rs:220:12 | LL | } else { | ____________^ @@ -202,7 +202,7 @@ LL | | } | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:217:13 + --> $DIR/if_same_then_else.rs:218:13 | LL | if true { | _____________^ @@ -211,7 +211,7 @@ LL | | } else { | |_____^ error: this `if` has identical blocks - --> $DIR/if_same_then_else.rs:244:12 + --> $DIR/if_same_then_else.rs:245:12 | LL | } else { | ____________^ @@ -221,7 +221,7 @@ LL | | } | |_____^ | note: same as this - --> $DIR/if_same_then_else.rs:241:20 + --> $DIR/if_same_then_else.rs:242:20 | LL | } else if true { | ____________________^ @@ -231,14 +231,14 @@ LL | | } else { | |_____^ error: this `if` has the same condition as a previous if - --> $DIR/if_same_then_else.rs:241:15 + --> $DIR/if_same_then_else.rs:242:15 | LL | } else if true { | ^^^^ | = note: `#[deny(clippy::ifs_same_cond)]` on by default note: same as this - --> $DIR/if_same_then_else.rs:235:8 + --> $DIR/if_same_then_else.rs:236:8 | LL | if true { | ^^^^ diff --git a/tests/ui/redundant_closure_call.rs b/tests/ui/redundant_closure_call.rs index 2304871f2134..81b7d0734db9 100644 --- a/tests/ui/redundant_closure_call.rs +++ b/tests/ui/redundant_closure_call.rs @@ -1,4 +1,5 @@ #![warn(clippy::redundant_closure_call)] +#![allow(deprecated)] // for `try` macro fn main() { let a = (|| 42)(); diff --git a/tests/ui/redundant_closure_call.stderr b/tests/ui/redundant_closure_call.stderr index 9c827fd8f17c..1d8ae9e31059 100644 --- a/tests/ui/redundant_closure_call.stderr +++ b/tests/ui/redundant_closure_call.stderr @@ -1,5 +1,5 @@ error: Closure called just once immediately after it was declared - --> $DIR/redundant_closure_call.rs:12:5 + --> $DIR/redundant_closure_call.rs:13:5 | LL | i = closure(); | ^^^^^^^^^^^^^ @@ -7,25 +7,25 @@ LL | i = closure(); = note: `-D clippy::redundant-closure-call` implied by `-D warnings` error: Closure called just once immediately after it was declared - --> $DIR/redundant_closure_call.rs:15:5 + --> $DIR/redundant_closure_call.rs:16:5 | LL | i = closure(3); | ^^^^^^^^^^^^^^ error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:4:13 + --> $DIR/redundant_closure_call.rs:5:13 | LL | let a = (|| 42)(); | ^^^^^^^^^ help: Try doing something like: : `42` error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:7:17 + --> $DIR/redundant_closure_call.rs:8:17 | LL | let mut k = (|m| m + 1)(i); | ^^^^^^^^^^^^^^ error: Try not to call a closure in the expression where it is declared. - --> $DIR/redundant_closure_call.rs:9:9 + --> $DIR/redundant_closure_call.rs:10:9 | LL | k = (|a, b| a * b)(1, 5); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unused_io_amount.rs b/tests/ui/unused_io_amount.rs index 40968822493f..89d5d1099f95 100644 --- a/tests/ui/unused_io_amount.rs +++ b/tests/ui/unused_io_amount.rs @@ -1,4 +1,5 @@ #![allow(dead_code)] +#![allow(deprecated)] // for `try` macro #![warn(clippy::unused_io_amount)] use std::io; diff --git a/tests/ui/unused_io_amount.stderr b/tests/ui/unused_io_amount.stderr index dbf701e06f9a..c09e5a02732e 100644 --- a/tests/ui/unused_io_amount.stderr +++ b/tests/ui/unused_io_amount.stderr @@ -1,5 +1,5 @@ error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:7:5 + --> $DIR/unused_io_amount.rs:8:5 | LL | r#try!(s.write(b"test")); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | r#try!(s.write(b"test")); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:9:5 + --> $DIR/unused_io_amount.rs:10:5 | LL | r#try!(s.read(&mut buf)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,25 +16,25 @@ LL | r#try!(s.read(&mut buf)); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:14:5 + --> $DIR/unused_io_amount.rs:15:5 | LL | s.write(b"test")?; | ^^^^^^^^^^^^^^^^^ error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:16:5 + --> $DIR/unused_io_amount.rs:17:5 | LL | s.read(&mut buf)?; | ^^^^^^^^^^^^^^^^^ error: handle written amount returned or use `Write::write_all` instead - --> $DIR/unused_io_amount.rs:21:5 + --> $DIR/unused_io_amount.rs:22:5 | LL | s.write(b"test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: handle read amount returned or use `Read::read_exact` instead - --> $DIR/unused_io_amount.rs:23:5 + --> $DIR/unused_io_amount.rs:24:5 | LL | s.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^