]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui-toml/functions_maxlines/test.rs
Rollup merge of #82554 - SkiFire13:fix-string-retain-unsoundness, r=m-ou-se
[rust.git] / src / tools / clippy / tests / ui-toml / functions_maxlines / test.rs
1 #![warn(clippy::too_many_lines)]
2
3 // This function should be considered one line.
4 fn many_comments_but_one_line_of_code() {
5     /* println!("This is good."); */
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 }
16
17 // This should be considered two and a fail.
18 fn too_many_lines() {
19     println!("This is bad.");
20     println!("This is bad.");
21 }
22
23 // This should be considered one line.
24 #[rustfmt::skip]
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 #[rustfmt::skip]
38 fn comment_before_code() {
39     let _ = "test";
40     /* This comment extends to the front of
41     the code but this line should still count. */ let _ = 5;
42 }
43
44 // This should be considered one line.
45 fn main() {}