move lint documentation into macro invocations
This commit is contained in:
parent
a8f61e70a8
commit
fe96ffeac9
132 changed files with 5405 additions and 5390 deletions
|
@ -10,39 +10,39 @@ use rustc_errors::Applicability;
|
|||
use syntax::ast::LitKind;
|
||||
use syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
|
||||
|
||||
/// **What it does:** Checks for boolean expressions that can be written more
|
||||
/// concisely.
|
||||
///
|
||||
/// **Why is this bad?** Readability of boolean expressions suffers from
|
||||
/// unnecessary duplication.
|
||||
///
|
||||
/// **Known problems:** Ignores short circuiting behavior of `||` and
|
||||
/// `&&`. Ignores `|`, `&` and `^`.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// if a && true // should be: if a
|
||||
/// if !(a == b) // should be: if a != b
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for boolean expressions that can be written more
|
||||
/// concisely.
|
||||
///
|
||||
/// **Why is this bad?** Readability of boolean expressions suffers from
|
||||
/// unnecessary duplication.
|
||||
///
|
||||
/// **Known problems:** Ignores short circuiting behavior of `||` and
|
||||
/// `&&`. Ignores `|`, `&` and `^`.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// if a && true // should be: if a
|
||||
/// if !(a == b) // should be: if a != b
|
||||
/// ```
|
||||
pub NONMINIMAL_BOOL,
|
||||
complexity,
|
||||
"boolean expressions that can be written more concisely"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for boolean expressions that contain terminals that
|
||||
/// can be eliminated.
|
||||
///
|
||||
/// **Why is this bad?** This is most likely a logic bug.
|
||||
///
|
||||
/// **Known problems:** Ignores short circuiting behavior.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// if a && b || a { ... }
|
||||
/// ```
|
||||
/// The `b` is unnecessary, the expression is equivalent to `if a`.
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for boolean expressions that contain terminals that
|
||||
/// can be eliminated.
|
||||
///
|
||||
/// **Why is this bad?** This is most likely a logic bug.
|
||||
///
|
||||
/// **Known problems:** Ignores short circuiting behavior.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// if a && b || a { ... }
|
||||
/// ```
|
||||
/// The `b` is unnecessary, the expression is equivalent to `if a`.
|
||||
pub LOGIC_BUG,
|
||||
correctness,
|
||||
"boolean expressions that contain terminals which can be eliminated"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue