File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,13 @@ declare_clippy_lint! {
2323 ///
2424 /// **Example:**
2525 /// ```rust
26+ /// // Bad
2627 /// 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;
2733 /// ```
2834 pub APPROX_CONSTANT ,
2935 correctness,
Original file line number Diff line number Diff line change @@ -24,9 +24,15 @@ declare_clippy_lint! {
2424 ///
2525 /// **Example:**
2626 /// ```rust
27+ /// // Bad: unnecessary lifetime annotations
2728 /// fn in_and_out<'a>(x: &'a u8, y: u8) -> &'a u8 {
2829 /// x
2930 /// }
31+ ///
32+ /// // Good
33+ /// fn elided(x: &u8, y: u8) -> &u8 {
34+ /// x
35+ /// }
3036 /// ```
3137 pub NEEDLESS_LIFETIMES ,
3238 complexity,
@@ -46,9 +52,15 @@ declare_clippy_lint! {
4652 ///
4753 /// **Example:**
4854 /// ```rust
55+ /// // Bad: unnecessary lifetimes
4956 /// fn unused_lifetime<'a>(x: u8) {
5057 /// // ..
5158 /// }
59+ ///
60+ /// // Good
61+ /// fn no_lifetime(x: u8) {
62+ /// // ...
63+ /// }
5264 /// ```
5365 pub EXTRA_UNUSED_LIFETIMES ,
5466 complexity,
You can’t perform that action at this time.
0 commit comments