Skip to content

Commit f907986

Browse files
committed
Added documentation
1 parent eb9c669 commit f907986

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

clippy_lints/src/semicolon_if_nothing_returned.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,31 @@ use rustc_middle::ty;
77
use rustc_session::{declare_lint_pass, declare_tool_lint};
88

99
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.
1112
///
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.
1316
///
1417
/// **Known problems:** None.
1518
///
1619
/// **Example:**
1720
///
1821
/// ```rust
19-
/// // example code where clippy issues a warning
22+
/// fn main() {
23+
/// println!("Hello world")
24+
/// }
2025
/// ```
2126
/// Use instead:
2227
/// ```rust
23-
/// // example code which does not raise clippy warning
28+
/// fn main() {
29+
/// println!("Hello world");
30+
/// }
2431
/// ```
2532
pub SEMICOLON_IF_NOTHING_RETURNED,
2633
pedantic,
27-
"default lint description"
34+
"add a semicolon if nothing is returned"
2835
}
2936

3037
declare_lint_pass!(SemicolonIfNothingReturned => [SEMICOLON_IF_NOTHING_RETURNED]);

0 commit comments

Comments
 (0)