This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -7,21 +7,34 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
77
88declare_clippy_lint ! {
99 /// ### What it does
10- /// `exit()` terminates the program and doesn't provide a
11- /// stack trace.
10+ /// Detects calls to the `exit()` function which terminates the program.
1211 ///
1312 /// ### Why is this bad?
14- /// Ideally a program is terminated by finishing
13+ /// Exit terminates the program at the location it is called. For unrecoverable
14+ /// errors `panics` should be used to provide a stacktrace and potentualy other
15+ /// information. A normal termination or one with an error code should happen in
1516 /// the main function.
1617 ///
1718 /// ### Example
18- /// ```ignore
19+ /// ```
1920 /// std::process::exit(0)
2021 /// ```
22+ ///
23+ /// Use instead:
24+ ///
25+ /// ```ignore
26+ /// // To provide a stacktrace and additional information
27+ /// panic!("message");
28+ ///
29+ /// // or a main method with a return
30+ /// fn main() -> Result<(), i32> {
31+ /// Ok(())
32+ /// }
33+ /// ```
2134 #[ clippy:: version = "1.41.0" ]
2235 pub EXIT ,
2336 restriction,
24- "`std::process::exit` is called, terminating the program "
37+ "detects `std::process::exit` calls "
2538}
2639
2740declare_lint_pass ! ( Exit => [ EXIT ] ) ;
You can’t perform that action at this time.
0 commit comments