Rollup merge of #4832 - dario23:i4829, r=phansch
Add some positive examples to lint docs fixes #4829 changelog: Add some positive examples to lint docs
This commit is contained in:
commit
6686892cbf
@ -23,7 +23,13 @@ declare_clippy_lint! {
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// // Bad
|
||||
/// let x = 3.14;
|
||||
/// let y = 1_f64 / x;
|
||||
///
|
||||
/// // Good
|
||||
/// let x = std::f32::consts::PI;
|
||||
/// let y = std::f64::consts::FRAC_1_PI;
|
||||
/// ```
|
||||
pub APPROX_CONSTANT,
|
||||
correctness,
|
||||
|
@ -24,9 +24,15 @@ declare_clippy_lint! {
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// // Bad: unnecessary lifetime annotations
|
||||
/// fn in_and_out<'a>(x: &'a u8, y: u8) -> &'a u8 {
|
||||
/// x
|
||||
/// }
|
||||
///
|
||||
/// // Good
|
||||
/// fn elided(x: &u8, y: u8) -> &u8 {
|
||||
/// x
|
||||
/// }
|
||||
/// ```
|
||||
pub NEEDLESS_LIFETIMES,
|
||||
complexity,
|
||||
@ -46,9 +52,15 @@ declare_clippy_lint! {
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// // Bad: unnecessary lifetimes
|
||||
/// fn unused_lifetime<'a>(x: u8) {
|
||||
/// // ..
|
||||
/// }
|
||||
///
|
||||
/// // Good
|
||||
/// fn no_lifetime(x: u8) {
|
||||
/// // ...
|
||||
/// }
|
||||
/// ```
|
||||
pub EXTRA_UNUSED_LIFETIMES,
|
||||
complexity,
|
||||
|
Loading…
x
Reference in New Issue
Block a user