File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,13 @@ declare_clippy_lint! {
23
23
///
24
24
/// **Example:**
25
25
/// ```rust
26
+ /// // Bad
26
27
/// let x = 3.14;
28
+ /// let y = 1_f64 / x;
29
+ ///
30
+ /// // Good
31
+ /// let x = std::f32::consts::PI;
32
+ /// let y = std::f64::consts::FRAC_1_PI;
27
33
/// ```
28
34
pub APPROX_CONSTANT ,
29
35
correctness,
Original file line number Diff line number Diff line change @@ -24,9 +24,15 @@ declare_clippy_lint! {
24
24
///
25
25
/// **Example:**
26
26
/// ```rust
27
+ /// // Bad: unnecessary lifetime annotations
27
28
/// fn in_and_out<'a>(x: &'a u8, y: u8) -> &'a u8 {
28
29
/// x
29
30
/// }
31
+ ///
32
+ /// // Good
33
+ /// fn elided(x: &u8, y: u8) -> &u8 {
34
+ /// x
35
+ /// }
30
36
/// ```
31
37
pub NEEDLESS_LIFETIMES ,
32
38
complexity,
@@ -46,9 +52,15 @@ declare_clippy_lint! {
46
52
///
47
53
/// **Example:**
48
54
/// ```rust
55
+ /// // Bad: unnecessary lifetimes
49
56
/// fn unused_lifetime<'a>(x: u8) {
50
57
/// // ..
51
58
/// }
59
+ ///
60
+ /// // Good
61
+ /// fn no_lifetime(x: u8) {
62
+ /// // ...
63
+ /// }
52
64
/// ```
53
65
pub EXTRA_UNUSED_LIFETIMES ,
54
66
complexity,
You can’t perform that action at this time.
0 commit comments