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! {
606606 /// For the scenario where you can define a meaningful absolute error margin, consider using:
607607 ///
608608 /// ```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+ ///
609614 /// const ALLOWED_ERROR_VEHICLE_LENGTH_CM: f64 = 0.1;
610615 /// let within_tolerance = (x - y).abs() < ALLOWED_ERROR_VEHICLE_LENGTH_CM;
611616 /// println!("{within_tolerance}"); // true
@@ -647,7 +652,7 @@ declare_clippy_lint! {
647652 /// // Actual value: 1000.3000000000001
648653 /// println!("{x}");
649654 ///
650- /// let are_equal = x == y ;
655+ /// let are_equal = x == Y ;
651656 /// println!("{are_equal}"); // false
652657 /// ```
653658 ///
@@ -664,6 +669,11 @@ declare_clippy_lint! {
664669 /// For the scenario where you can define a meaningful absolute error margin, consider using:
665670 ///
666671 /// ```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+ ///
667677 /// const ALLOWED_ERROR_VEHICLE_LENGTH_CM: f64 = 0.1;
668678 /// let within_tolerance = (x - Y).abs() < ALLOWED_ERROR_VEHICLE_LENGTH_CM;
669679 /// println!("{within_tolerance}"); // true
You can’t perform that action at this time.
0 commit comments