1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

#![allow(clippy::float_cmp)] everywhere

it has always been an annoyance, never a help
This commit is contained in:
Emil Ernerfeldt
2021-05-09 14:00:53 +02:00
parent 6ad6f56cb1
commit fb5176c133
14 changed files with 7 additions and 24 deletions

View File

@@ -62,6 +62,7 @@
nonstandard_style,
rust_2018_idioms
)]
#![allow(clippy::float_cmp)]
#![allow(clippy::manual_range_contains)]
use std::ops::{Add, Div, Mul, RangeInclusive, Sub};
@@ -141,7 +142,6 @@ pub fn remap<T>(x: T, from: RangeInclusive<T>, to: RangeInclusive<T>) -> T
where
T: Real,
{
#![allow(clippy::float_cmp)]
debug_assert!(from.start() != from.end());
let t = (x - *from.start()) / (*from.end() - *from.start());
lerp(to, t)
@@ -152,7 +152,6 @@ pub fn remap_clamp<T>(x: T, from: RangeInclusive<T>, to: RangeInclusive<T>) -> T
where
T: Real,
{
#![allow(clippy::float_cmp)]
if from.end() < from.start() {
return remap_clamp(x, *from.end()..=*from.start(), *to.end()..=*to.start());
}
@@ -235,8 +234,6 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
/// The `epsilon` can be `f32::EPSILON` to handle simple transforms (like degrees -> radians)
/// but should be higher to handle more complex transformations.
pub fn almost_equal(a: f32, b: f32, epsilon: f32) -> bool {
#![allow(clippy::float_cmp)]
if a == b {
true // handle infinites
} else {
@@ -292,7 +289,6 @@ fn test_almost_equal() {
}
}
#[allow(clippy::float_cmp)]
#[test]
fn test_remap() {
assert_eq!(remap_clamp(1.0, 0.0..=1.0, 0.0..=16.0), 16.0);

View File

@@ -1,7 +1,5 @@
//! Find "simple" numbers is some range. Used by sliders.
#![allow(clippy::float_cmp)] // I know what I'm doing
const NUM_DECIMALS: usize = 15;
/// Find the "simplest" number in a closed range [min, max], i.e. the one with the fewest decimal digits.

View File

@@ -422,8 +422,6 @@ impl std::fmt::Debug for Vec2 {
#[test]
fn test_vec2() {
#![allow(clippy::float_cmp)]
macro_rules! almost_eq {
($left:expr, $right:expr) => {
let left = $left;