clean up a few lint docs

This commit is contained in:
Matthias Krüger 2020-03-18 02:50:39 +01:00
parent 23549a8c36
commit 2204bf20ae
6 changed files with 14 additions and 10 deletions

View File

@ -23,11 +23,11 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust
/// // Bad
/// let x = 3.14;
/// let y = 1_f64 / x;
///
/// // Good
/// ```
/// Use predefined constants instead:
/// ```rust
/// let x = std::f32::consts::PI;
/// let y = std::f64::consts::FRAC_1_PI;
/// ```

View File

@ -11,16 +11,14 @@ declare_clippy_lint! {
/// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
///
/// **Why is this bad?** Will be optimized out by the compiler or should probably be replaced by a
/// panic!() or unreachable!()
/// `panic!()` or `unreachable!()`
///
/// **Known problems:** None
///
/// **Example:**
/// ```rust,ignore
/// assert!(false)
/// // or
/// assert!(true)
/// // or
/// const B: bool = false;
/// assert!(B)
/// ```

View File

@ -35,7 +35,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```ignore
/// ```rust,ignore
/// if { let x = somefunc(); x } {}
/// // or
/// if somefunc(|x| { x == 47 }) {}

View File

@ -51,7 +51,13 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust,ignore
/// if x == true {} // could be `if x { }`
/// if x == true {}
/// if y == false {}
/// ```
/// use `x` directly:
/// ```rust,ignore
/// if x {}
/// if !y {}
/// ```
pub BOOL_COMPARISON,
complexity,

View File

@ -54,7 +54,7 @@ declare_clippy_lint! {
/// a = b;
/// b = a;
/// ```
/// Could be written as:
/// If swapping is intended, use `swap()` instead:
/// ```rust
/// # let mut a = 1;
/// # let mut b = 2;

View File

@ -1642,7 +1642,7 @@ declare_clippy_lint! {
/// **Example:**
///
/// ```rust
/// let vec: Vec<isize> = vec![];
/// let vec: Vec<isize> = Vec::new();
/// if vec.len() <= 0 {}
/// if 100 > std::i32::MAX {}
/// ```