Skip to content

Fix tests fail because of deprecated try macro #4385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/ui/cognitive_complexity.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![allow(clippy::all)]
#![warn(clippy::cognitive_complexity)]
#![allow(unused)]
#![allow(deprecated)] // for deprecated `try` macro

#[rustfmt::skip]
fn main() {
Expand Down
40 changes: 20 additions & 20 deletions tests/ui/cognitive_complexity.stderr
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand All @@ -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 {
| _____________^
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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<i32, &'static str> {
LL | | match 5 {
Expand All @@ -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<i32, &'static str> {
LL | | let _ = r#try!(Ok(42));
Expand All @@ -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<i32, &'static str> {
LL | | return Ok(5);
Expand All @@ -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; };
Expand Down
1 change: 1 addition & 0 deletions tests/ui/if_same_then_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
clippy::zero_divided_by_zero,
clippy::unused_unit
)]
#![allow(deprecated)] // for `try` macro

struct Foo {
bar: u8,
Expand Down
Loading