clean up a few lint docs
This commit is contained in:
@@ -23,11 +23,11 @@ declare_clippy_lint! {
|
|||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// // Bad
|
|
||||||
/// let x = 3.14;
|
/// let x = 3.14;
|
||||||
/// let y = 1_f64 / x;
|
/// let y = 1_f64 / x;
|
||||||
///
|
/// ```
|
||||||
/// // Good
|
/// Use predefined constants instead:
|
||||||
|
/// ```rust
|
||||||
/// let x = std::f32::consts::PI;
|
/// let x = std::f32::consts::PI;
|
||||||
/// let y = std::f64::consts::FRAC_1_PI;
|
/// let y = std::f64::consts::FRAC_1_PI;
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
@@ -11,16 +11,14 @@ declare_clippy_lint! {
|
|||||||
/// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
|
/// **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
|
/// **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
|
/// **Known problems:** None
|
||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// assert!(false)
|
/// assert!(false)
|
||||||
/// // or
|
|
||||||
/// assert!(true)
|
/// assert!(true)
|
||||||
/// // or
|
|
||||||
/// const B: bool = false;
|
/// const B: bool = false;
|
||||||
/// assert!(B)
|
/// assert!(B)
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ declare_clippy_lint! {
|
|||||||
/// **Known problems:** None.
|
/// **Known problems:** None.
|
||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```ignore
|
/// ```rust,ignore
|
||||||
/// if { let x = somefunc(); x } {}
|
/// if { let x = somefunc(); x } {}
|
||||||
/// // or
|
/// // or
|
||||||
/// if somefunc(|x| { x == 47 }) {}
|
/// if somefunc(|x| { x == 47 }) {}
|
||||||
|
|||||||
@@ -51,7 +51,13 @@ declare_clippy_lint! {
|
|||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rust,ignore
|
/// ```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,
|
pub BOOL_COMPARISON,
|
||||||
complexity,
|
complexity,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ declare_clippy_lint! {
|
|||||||
/// a = b;
|
/// a = b;
|
||||||
/// b = a;
|
/// b = a;
|
||||||
/// ```
|
/// ```
|
||||||
/// Could be written as:
|
/// If swapping is intended, use `swap()` instead:
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # let mut a = 1;
|
/// # let mut a = 1;
|
||||||
/// # let mut b = 2;
|
/// # let mut b = 2;
|
||||||
|
|||||||
@@ -1642,7 +1642,7 @@ declare_clippy_lint! {
|
|||||||
/// **Example:**
|
/// **Example:**
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// let vec: Vec<isize> = vec![];
|
/// let vec: Vec<isize> = Vec::new();
|
||||||
/// if vec.len() <= 0 {}
|
/// if vec.len() <= 0 {}
|
||||||
/// if 100 > std::i32::MAX {}
|
/// if 100 > std::i32::MAX {}
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
Reference in New Issue
Block a user