Skip to content

Commit 3a97b5f

Browse files
Unknownunknown
Unknown
authored and
unknown
committed
Moving tests to ui-toml to make use of clippy.toml
1 parent 7fbd55c commit 3a97b5f

File tree

5 files changed

+68
-178
lines changed

5 files changed

+68
-178
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
too-many-lines-threshold = 1
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#![warn(clippy::too_many_lines)]
2+
3+
4+
// This function should be considered one line.
5+
fn many_comments_but_one_line_of_code() {
6+
/* println!("This is good."); */
7+
// println!("This is good.");
8+
/* */ // println!("This is good.");
9+
/* */ // println!("This is good.");
10+
/* */ // println!("This is good.");
11+
/* */ // println!("This is good.");
12+
/* println!("This is good.");
13+
println!("This is good.");
14+
println!("This is good."); */
15+
println!("This is good.");
16+
}
17+
18+
// This should be considered two and a fail.
19+
fn too_many_lines() {
20+
println!("This is bad.");
21+
println!("This is bad.");
22+
}
23+
24+
// This should be considered one line.
25+
fn comment_starts_after_code() {
26+
let _ = 5; /* closing comment. */ /*
27+
this line shouldn't be counted theoretically.
28+
*/
29+
}
30+
31+
// This should be considered one line.
32+
fn comment_after_code() {
33+
let _ = 5; /* this line should get counted once. */
34+
}
35+
36+
// This should fail since it is technically two lines.
37+
fn comment_before_code() {
38+
let _ = "test";
39+
/* This comment extends to the front of
40+
teh code but this line should still count. */ let _ = 5;
41+
}
42+
43+
// This should be considered one line.
44+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error: This function has a large number of lines.
2+
--> $DIR/test.rs:19:1
3+
|
4+
LL | / fn too_many_lines() {
5+
LL | | println!("This is bad.");
6+
LL | | println!("This is bad.");
7+
LL | | }
8+
| |_^
9+
|
10+
= note: `-D clippy::too-many-lines` implied by `-D warnings`
11+
12+
error: This function has a large number of lines.
13+
--> $DIR/test.rs:37:1
14+
|
15+
LL | / fn comment_before_code() {
16+
LL | | let _ = "test";
17+
LL | | /* This comment extends to the front of
18+
LL | | teh code but this line should still count. */ let _ = 5;
19+
LL | | }
20+
| |_^
21+
22+
error: aborting due to 2 previous errors
23+

tests/ui/functions_maxlines.rs

-162
This file was deleted.

tests/ui/functions_maxlines.stderr

-16
This file was deleted.

0 commit comments

Comments
 (0)