Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/// ```
Expand Down
4 changes: 1 addition & 3 deletions clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/// ```
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {}
Expand Down
8 changes: 7 additions & 1 deletion clippy_lints/src/needless_bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
/// ```
Expand Down