1
Fork 0

move lint documentation into macro invocations

This commit is contained in:
Andy Russell 2019-03-05 11:50:33 -05:00
parent a8f61e70a8
commit fe96ffeac9
No known key found for this signature in database
GPG key ID: BE2221033EDBC374
132 changed files with 5405 additions and 5390 deletions

View file

@ -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"