Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
1c3t3a committed Feb 5, 2021
1 parent eb9c669 commit f907986
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions clippy_lints/src/semicolon_if_nothing_returned.rs
Expand Up @@ -7,24 +7,31 @@ use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// **What it does:**
/// **What it does:** Looks for blocks of expressions and fires if the last expression returns `()`
/// but is not followed by a semicolon.
///
/// **Why is this bad?**
/// **Why is this bad?** The semicolon might be optional but when
/// extending the block with new code, it doesn't require a change in previous last line.
/// It's also more idiomatic.
///
/// **Known problems:** None.
///
/// **Example:**
///
/// ```rust
/// // example code where clippy issues a warning
/// fn main() {
/// println!("Hello world")
/// }
/// ```
/// Use instead:
/// ```rust
/// // example code which does not raise clippy warning
/// fn main() {
/// println!("Hello world");
/// }
/// ```
pub SEMICOLON_IF_NOTHING_RETURNED,
pedantic,
"default lint description"
"add a semicolon if nothing is returned"
}

declare_lint_pass!(SemicolonIfNothingReturned => [SEMICOLON_IF_NOTHING_RETURNED]);
Expand Down

0 comments on commit f907986

Please sign in to comment.