mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 21:53:23 +00:00
Added documentation
This commit is contained in:
parent
eb9c6698ee
commit
f907986580
1 changed files with 12 additions and 5 deletions
|
@ -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]);
|
||||||
|
|
Loading…
Reference in a new issue