Skip to content

Commit c6e6b29

Browse files
committed
add a good example for the approx_const lint
1 parent c58a5c6 commit c6e6b29

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clippy_lints/src/approx_const.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)