Skip to content

Commit 08fc398

Browse files
committed
Auto merge of #5331 - matthiaskrgr:lint_docs1, r=flip1995
clean up a few lint docs changelog: none
2 parents 89cffe1 + 2204bf2 commit 08fc398

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

clippy_lints/src/approx_const.rs

+3-3
Original file line numberDiff line numberDiff 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
/// ```

clippy_lints/src/assertions_on_constants.rs

+1-3
Original file line numberDiff line numberDiff 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
/// ```

clippy_lints/src/block_in_if_condition.rs

+1-1
Original file line numberDiff line numberDiff 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 }) {}

clippy_lints/src/needless_bool.rs

+7-1
Original file line numberDiff line numberDiff 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,

clippy_lints/src/swap.rs

+1-1
Original file line numberDiff line numberDiff 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;

clippy_lints/src/types.rs

+1-1
Original file line numberDiff line numberDiff 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
/// ```

0 commit comments

Comments
 (0)