File tree Expand file tree Collapse file tree 6 files changed +14
-10
lines changed Expand file tree Collapse file tree 6 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,11 @@ declare_clippy_lint! {
2323 ///
2424 /// **Example:**
2525 /// ```rust
26- /// // Bad
2726 /// let x = 3.14;
2827 /// let y = 1_f64 / x;
29- ///
30- /// // Good
28+ /// ```
29+ /// Use predefined constants instead:
30+ /// ```rust
3131 /// let x = std::f32::consts::PI;
3232 /// let y = std::f64::consts::FRAC_1_PI;
3333 /// ```
Original file line number Diff line number Diff line change @@ -11,16 +11,14 @@ declare_clippy_lint! {
1111 /// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
1212 ///
1313 /// **Why is this bad?** Will be optimized out by the compiler or should probably be replaced by a
14- /// panic!() or unreachable!()
14+ /// ` panic!()` or ` unreachable!()`
1515 ///
1616 /// **Known problems:** None
1717 ///
1818 /// **Example:**
1919 /// ```rust,ignore
2020 /// assert!(false)
21- /// // or
2221 /// assert!(true)
23- /// // or
2422 /// const B: bool = false;
2523 /// assert!(B)
2624 /// ```
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ declare_clippy_lint! {
3535 /// **Known problems:** None.
3636 ///
3737 /// **Example:**
38- /// ```ignore
38+ /// ```rust, ignore
3939 /// if { let x = somefunc(); x } {}
4040 /// // or
4141 /// if somefunc(|x| { x == 47 }) {}
Original file line number Diff line number Diff line change @@ -51,7 +51,13 @@ declare_clippy_lint! {
5151 ///
5252 /// **Example:**
5353 /// ```rust,ignore
54- /// if x == true {} // could be `if x { }`
54+ /// if x == true {}
55+ /// if y == false {}
56+ /// ```
57+ /// use `x` directly:
58+ /// ```rust,ignore
59+ /// if x {}
60+ /// if !y {}
5561 /// ```
5662 pub BOOL_COMPARISON ,
5763 complexity,
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ declare_clippy_lint! {
5454 /// a = b;
5555 /// b = a;
5656 /// ```
57- /// Could be written as :
57+ /// If swapping is intended, use `swap()` instead :
5858 /// ```rust
5959 /// # let mut a = 1;
6060 /// # let mut b = 2;
Original file line number Diff line number Diff line change @@ -1642,7 +1642,7 @@ declare_clippy_lint! {
16421642 /// **Example:**
16431643 ///
16441644 /// ```rust
1645- /// let vec: Vec<isize> = vec![] ;
1645+ /// let vec: Vec<isize> = Vec::new() ;
16461646 /// if vec.len() <= 0 {}
16471647 /// if 100 > std::i32::MAX {}
16481648 /// ```
You can’t perform that action at this time.
0 commit comments