mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Update tests for exit
This commit is contained in:
parent
abdf027df3
commit
5e6017d193
5 changed files with 32 additions and 6 deletions
|
@ -6,15 +6,10 @@ fn not_main() {
|
|||
}
|
||||
}
|
||||
|
||||
fn also_not_main() {
|
||||
std::process::exit(3);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if true {
|
||||
std::process::exit(2);
|
||||
};
|
||||
also_not_main();
|
||||
not_main();
|
||||
std::process::exit(1);
|
||||
}
|
10
tests/ui/exit1.stderr
Normal file
10
tests/ui/exit1.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error: usage of `process::exit`
|
||||
--> $DIR/exit1.rs:5:9
|
||||
|
|
||||
LL | std::process::exit(4);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::exit` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
13
tests/ui/exit2.rs
Normal file
13
tests/ui/exit2.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
#[warn(clippy::exit)]
|
||||
|
||||
fn also_not_main() {
|
||||
std::process::exit(3);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if true {
|
||||
std::process::exit(2);
|
||||
};
|
||||
also_not_main();
|
||||
std::process::exit(1);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
error: usage of `process::exit`
|
||||
--> $DIR/exit.rs:3:5
|
||||
--> $DIR/exit2.rs:4:5
|
||||
|
|
||||
LL | std::process::exit(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
8
tests/ui/exit3.rs
Normal file
8
tests/ui/exit3.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
#[warn(clippy::exit)]
|
||||
|
||||
fn main() {
|
||||
if true {
|
||||
std::process::exit(2);
|
||||
};
|
||||
std::process::exit(1);
|
||||
}
|
Loading…
Reference in a new issue