File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
clippy_lints/src/operators Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -606,6 +606,11 @@ declare_clippy_lint! {
606
606
/// For the scenario where you can define a meaningful absolute error margin, consider using:
607
607
///
608
608
/// ```no_run
609
+ /// let a: f64 = 1000.1;
610
+ /// let b: f64 = 0.2;
611
+ /// let x = a + b;
612
+ /// let y = 1000.3; // Expected value.
613
+ ///
609
614
/// const ALLOWED_ERROR_VEHICLE_LENGTH_CM: f64 = 0.1;
610
615
/// let within_tolerance = (x - y).abs() < ALLOWED_ERROR_VEHICLE_LENGTH_CM;
611
616
/// println!("{within_tolerance}"); // true
@@ -647,7 +652,7 @@ declare_clippy_lint! {
647
652
/// // Actual value: 1000.3000000000001
648
653
/// println!("{x}");
649
654
///
650
- /// let are_equal = x == y ;
655
+ /// let are_equal = x == Y ;
651
656
/// println!("{are_equal}"); // false
652
657
/// ```
653
658
///
@@ -664,6 +669,11 @@ declare_clippy_lint! {
664
669
/// For the scenario where you can define a meaningful absolute error margin, consider using:
665
670
///
666
671
/// ```no_run
672
+ /// let a: f64 = 1000.1;
673
+ /// let b: f64 = 0.2;
674
+ /// let x = a + b;
675
+ /// const Y: f64 = 1000.3; // Expected value.
676
+ ///
667
677
/// const ALLOWED_ERROR_VEHICLE_LENGTH_CM: f64 = 0.1;
668
678
/// let within_tolerance = (x - Y).abs() < ALLOWED_ERROR_VEHICLE_LENGTH_CM;
669
679
/// println!("{within_tolerance}"); // true
You can’t perform that action at this time.
0 commit comments