x4 as f64;
let x5 = 1u32;
x5 as f64;
+
+ // Test with casts from floating-point types
+ 1.0f32 as f64;
}
// The lint would suggest using `f64::from(input)` here but the `XX::from` function is not const,
const fn abc(input: f32) -> f64 {
input as f64
}
+
+// Same as the above issue. We can't suggest `::from` in const fns in impls
+mod cast_lossless_in_impl {
+ struct A;
+
+ impl A {
+ pub const fn convert(x: f32) -> f64 {
+ x as f64
+ }
+ }
+}