File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -7,24 +7,31 @@ use rustc_middle::ty;
7
7
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
8
8
9
9
declare_clippy_lint ! {
10
- /// **What it does:**
10
+ /// **What it does:** Looks for blocks of expressions and fires if the last expression returns `()`
11
+ /// but is not followed by a semicolon.
11
12
///
12
- /// **Why is this bad?**
13
+ /// **Why is this bad?** The semicolon might be optional but when
14
+ /// extending the block with new code, it doesn't require a change in previous last line.
15
+ /// It's also more idiomatic.
13
16
///
14
17
/// **Known problems:** None.
15
18
///
16
19
/// **Example:**
17
20
///
18
21
/// ```rust
19
- /// // example code where clippy issues a warning
22
+ /// fn main() {
23
+ /// println!("Hello world")
24
+ /// }
20
25
/// ```
21
26
/// Use instead:
22
27
/// ```rust
23
- /// // example code which does not raise clippy warning
28
+ /// fn main() {
29
+ /// println!("Hello world");
30
+ /// }
24
31
/// ```
25
32
pub SEMICOLON_IF_NOTHING_RETURNED ,
26
33
pedantic,
27
- "default lint description "
34
+ "add a semicolon if nothing is returned "
28
35
}
29
36
30
37
declare_lint_pass ! ( SemicolonIfNothingReturned => [ SEMICOLON_IF_NOTHING_RETURNED ] ) ;
You can’t perform that action at this time.
0 commit comments