1 // does not test any rustfixable lints
3 #![warn(clippy::float_cmp_const)]
4 #![allow(clippy::float_cmp)]
5 #![allow(unused, clippy::no_effect, clippy::unnecessary_operation)]
10 fn eq_one(x: f32) -> bool {
15 } // no error, inside "eq" fn
31 // no errors, lower than or greater than comparisons
37 // no errors, zero and infinity values
41 ONE == f32::NEG_INFINITY;
43 // no errors, but will warn clippy::float_cmp if '#![allow(float_cmp)]' above is removed
50 const ZERO_ARRAY: [f32; 3] = [0.0, 0.0, 0.0];
51 const ZERO_INF_ARRAY: [f32; 3] = [0.0, ::std::f32::INFINITY, ::std::f32::NEG_INFINITY];
52 const NON_ZERO_ARRAY: [f32; 3] = [0.0, 0.1, 0.2];
53 const NON_ZERO_ARRAY2: [f32; 3] = [0.2, 0.1, 0.0];
55 // no errors, zero and infinity values
56 NON_ZERO_ARRAY[0] == NON_ZERO_ARRAY2[1]; // lhs is 0.0
57 ZERO_ARRAY == NON_ZERO_ARRAY; // lhs is all zeros
58 ZERO_INF_ARRAY == NON_ZERO_ARRAY; // lhs is all zeros or infinities
61 NON_ZERO_ARRAY == NON_ZERO_ARRAY2;