Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving tests to ui-toml to make use of clippy.toml
- Loading branch information
Unknown
authored and
unknown
committed
Feb 1, 2019
1 parent
7fbd55c
commit 3a97b5f
Showing
5 changed files
with
68 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
too-many-lines-threshold = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#![warn(clippy::too_many_lines)] | ||
|
||
|
||
// This function should be considered one line. | ||
fn many_comments_but_one_line_of_code() { | ||
/* println!("This is good."); */ | ||
// println!("This is good."); | ||
/* */ // println!("This is good."); | ||
/* */ // println!("This is good."); | ||
/* */ // println!("This is good."); | ||
/* */ // println!("This is good."); | ||
/* println!("This is good."); | ||
println!("This is good."); | ||
println!("This is good."); */ | ||
println!("This is good."); | ||
} | ||
|
||
// This should be considered two and a fail. | ||
fn too_many_lines() { | ||
println!("This is bad."); | ||
println!("This is bad."); | ||
} | ||
|
||
// This should be considered one line. | ||
fn comment_starts_after_code() { | ||
let _ = 5; /* closing comment. */ /* | ||
this line shouldn't be counted theoretically. | ||
*/ | ||
} | ||
|
||
// This should be considered one line. | ||
fn comment_after_code() { | ||
let _ = 5; /* this line should get counted once. */ | ||
} | ||
|
||
// This should fail since it is technically two lines. | ||
fn comment_before_code() { | ||
let _ = "test"; | ||
/* This comment extends to the front of | ||
teh code but this line should still count. */ let _ = 5; | ||
} | ||
|
||
// This should be considered one line. | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: This function has a large number of lines. | ||
--> $DIR/test.rs:19:1 | ||
| | ||
LL | / fn too_many_lines() { | ||
LL | | println!("This is bad."); | ||
LL | | println!("This is bad."); | ||
LL | | } | ||
| |_^ | ||
| | ||
= note: `-D clippy::too-many-lines` implied by `-D warnings` | ||
|
||
error: This function has a large number of lines. | ||
--> $DIR/test.rs:37:1 | ||
| | ||
LL | / fn comment_before_code() { | ||
LL | | let _ = "test"; | ||
LL | | /* This comment extends to the front of | ||
LL | | teh code but this line should still count. */ let _ = 5; | ||
LL | | } | ||
| |_^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.