mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 10:45:41 +02:00
Rework for new clippy lints (#12736)
- **Clippy lint `assigning_clones`** - **Clippy lint `legacy_numeric_constants`** - **`clippy::float_equality_without_abs`** - **`nu-table`: clippy::zero_repeat_side_effects** --------- Co-authored-by: Ian Manske <ian.manske@pm.me>
This commit is contained in:
committed by
GitHub
parent
0805f1fd90
commit
b88d8726d0
@ -1141,18 +1141,18 @@ mod test {
|
||||
|
||||
let v: Value = from_str("{\"a\":1.1}").unwrap();
|
||||
let vo = v.as_object().unwrap();
|
||||
assert!(vo["a"].as_f64().unwrap() - 1.1 < std::f64::EPSILON);
|
||||
assert!((vo["a"].as_f64().unwrap() - 1.1).abs() < f64::EPSILON);
|
||||
|
||||
let v: Value = from_str("{\"a\":-1.1}").unwrap();
|
||||
let vo = v.as_object().unwrap();
|
||||
assert!(vo["a"].as_f64().unwrap() + 1.1 > -(std::f64::EPSILON));
|
||||
assert!((vo["a"].as_f64().unwrap() + 1.1).abs() < f64::EPSILON);
|
||||
|
||||
let v: Value = from_str("{\"a\":1e6}").unwrap();
|
||||
let vo = v.as_object().unwrap();
|
||||
assert!(vo["a"].as_f64().unwrap() - 1e6 < std::f64::EPSILON);
|
||||
assert!((vo["a"].as_f64().unwrap() - 1e6).abs() < f64::EPSILON);
|
||||
|
||||
let v: Value = from_str("{\"a\":-1e6}").unwrap();
|
||||
let vo = v.as_object().unwrap();
|
||||
assert!(vo["a"].as_f64().unwrap() + 1e6 > -(std::f64::EPSILON));
|
||||
assert!((vo["a"].as_f64().unwrap() + 1e6).abs() < f64::EPSILON);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user