]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/floating_point_mul_add.rs
Merge commit 'e36a20c24f35a4cee82bbdc600289104c9237c22' into ra-sync-and-pms-component
[rust.git] / src / tools / clippy / tests / ui / floating_point_mul_add.rs
index d202385fc8ae76a0ee0f169852b1d410b3a76f77..5338d4fc2b7490f4f0480b69379b8d3ee3ab2c67 100644 (file)
@@ -1,6 +1,17 @@
 // run-rustfix
+#![feature(const_fn_floating_point_arithmetic)]
 #![warn(clippy::suboptimal_flops)]
 
+/// Allow suboptimal_ops in constant context
+pub const fn in_const_context() {
+    let a: f64 = 1234.567;
+    let b: f64 = 45.67834;
+    let c: f64 = 0.0004;
+
+    let _ = a * b + c;
+    let _ = c + a * b;
+}
+
 fn main() {
     let a: f64 = 1234.567;
     let b: f64 = 45.67834;