Skip to content

Commit 21d3b9d

Browse files
committed
split test files for use_debug and print_stdout
1 parent 8ff0cf8 commit 21d3b9d

File tree

5 files changed

+84
-72
lines changed

5 files changed

+84
-72
lines changed

tests/ui/print.stderr

Lines changed: 0 additions & 56 deletions
This file was deleted.

tests/ui/print_stdout.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![expect(clippy::print_literal)]
2+
#![warn(clippy::print_stdout)]
3+
4+
fn main() {
5+
println!("Hello");
6+
//~^ print_stdout
7+
8+
print!("Hello");
9+
//~^ print_stdout
10+
11+
print!("Hello {}", "World");
12+
//~^ print_stdout
13+
14+
print!("Hello {:?}", "World");
15+
//~^ print_stdout
16+
17+
print!("Hello {:#?}", "#orld");
18+
//~^ print_stdout
19+
20+
assert_eq!(42, 1337);
21+
22+
vec![1, 2];
23+
}

tests/ui/print_stdout.stderr

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error: use of `println!`
2+
--> tests/ui/print_stdout.rs:5:5
3+
|
4+
LL | println!("Hello");
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `-D clippy::print-stdout` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::print_stdout)]`
9+
10+
error: use of `print!`
11+
--> tests/ui/print_stdout.rs:8:5
12+
|
13+
LL | print!("Hello");
14+
| ^^^^^^^^^^^^^^^
15+
16+
error: use of `print!`
17+
--> tests/ui/print_stdout.rs:11:5
18+
|
19+
LL | print!("Hello {}", "World");
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
error: use of `print!`
23+
--> tests/ui/print_stdout.rs:14:5
24+
|
25+
LL | print!("Hello {:?}", "World");
26+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+
28+
error: use of `print!`
29+
--> tests/ui/print_stdout.rs:17:5
30+
|
31+
LL | print!("Hello {:#?}", "#orld");
32+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
34+
error: aborting due to 5 previous errors
35+

tests/ui/print.rs renamed to tests/ui/use_debug.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
#![allow(clippy::print_literal, clippy::write_literal)]
2-
#![warn(clippy::print_stdout, clippy::use_debug)]
1+
#![warn(clippy::use_debug)]
32

43
use std::fmt::{Debug, Display, Formatter, Result};
54

6-
#[allow(dead_code)]
75
struct Foo;
86

97
impl Display for Foo {
@@ -21,22 +19,11 @@ impl Debug for Foo {
2119
}
2220

2321
fn main() {
24-
println!("Hello");
25-
//~^ print_stdout
26-
27-
print!("Hello");
28-
//~^ print_stdout
29-
30-
print!("Hello {}", "World");
31-
//~^ print_stdout
32-
3322
print!("Hello {:?}", "World");
34-
//~^ print_stdout
35-
//~| use_debug
23+
//~^ use_debug
3624

3725
print!("Hello {:#?}", "#orld");
38-
//~^ print_stdout
39-
//~| use_debug
26+
//~^ use_debug
4027

4128
assert_eq!(42, 1337);
4229

tests/ui/use_debug.stderr

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error: use of `Debug`-based formatting
2+
--> tests/ui/use_debug.rs:9:20
3+
|
4+
LL | write!(f, "{:?}", 43.1415)
5+
| ^^^^
6+
|
7+
= note: `-D clippy::use-debug` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::use_debug)]`
9+
10+
error: use of `Debug`-based formatting
11+
--> tests/ui/use_debug.rs:22:19
12+
|
13+
LL | print!("Hello {:?}", "World");
14+
| ^^^^
15+
16+
error: use of `Debug`-based formatting
17+
--> tests/ui/use_debug.rs:25:19
18+
|
19+
LL | print!("Hello {:#?}", "#orld");
20+
| ^^^^^
21+
22+
error: aborting due to 3 previous errors
23+

0 commit comments

Comments
 (0)