clean up a few lint docs
This commit is contained in:
parent
23549a8c36
commit
2204bf20ae
@ -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;
|
||||
/// ```
|
||||
|
@ -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)
|
||||
/// ```
|
||||
|
@ -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 }) {}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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 {}
|
||||
/// ```
|
||||
|
Loading…
x
Reference in New Issue
Block a user