Added documentation

This commit is contained in:
Bastian Kersting 2020-12-21 18:24:08 +01:00
parent eb9c6698ee
commit f907986580

View file

@ -7,24 +7,31 @@ use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_session::{declare_lint_pass, declare_tool_lint};
declare_clippy_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. /// **Known problems:** None.
/// ///
/// **Example:** /// **Example:**
/// ///
/// ```rust /// ```rust
/// // example code where clippy issues a warning /// fn main() {
/// println!("Hello world")
/// }
/// ``` /// ```
/// Use instead: /// Use instead:
/// ```rust /// ```rust
/// // example code which does not raise clippy warning /// fn main() {
/// println!("Hello world");
/// }
/// ``` /// ```
pub SEMICOLON_IF_NOTHING_RETURNED, pub SEMICOLON_IF_NOTHING_RETURNED,
pedantic, pedantic,
"default lint description" "add a semicolon if nothing is returned"
} }
declare_lint_pass!(SemicolonIfNothingReturned => [SEMICOLON_IF_NOTHING_RETURNED]); declare_lint_pass!(SemicolonIfNothingReturned => [SEMICOLON_IF_NOTHING_RETURNED]);