summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/floating_point_mul_add.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/floating_point_mul_add.rs')
-rw-r--r--src/tools/clippy/tests/ui/floating_point_mul_add.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/floating_point_mul_add.rs b/src/tools/clippy/tests/ui/floating_point_mul_add.rs
index 262a20f0f..b5e4a8db4 100644
--- a/src/tools/clippy/tests/ui/floating_point_mul_add.rs
+++ b/src/tools/clippy/tests/ui/floating_point_mul_add.rs
@@ -39,3 +39,21 @@ fn main() {
// Cases where the lint shouldn't be applied
let _ = (a * a + b * b).sqrt();
}
+
+fn _issue11831() {
+ struct NotAFloat;
+
+ impl std::ops::Add<f64> for NotAFloat {
+ type Output = Self;
+
+ fn add(self, _: f64) -> Self {
+ NotAFloat
+ }
+ }
+
+ let a = NotAFloat;
+ let b = 1.0_f64;
+ let c = 1.0;
+
+ let _ = a + b * c;
+}