mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Never store a squared root in SquaredDistance
This commit is contained in:
parent
df079286c2
commit
6ce5e9a869
4 changed files with 27 additions and 31 deletions
|
@ -28,7 +28,7 @@ pub fn derive(input: DeriveInput) -> Tokens {
|
|||
let (this_pattern, this_info) = cg::ref_pattern(&variant, "this");
|
||||
let (other_pattern, other_info) = cg::ref_pattern(&variant, "other");
|
||||
let sum = if this_info.is_empty() {
|
||||
quote! { ::values::distance::SquaredDistance::Value(0.) }
|
||||
quote! { ::values::distance::SquaredDistance::from_sqrt(0.) }
|
||||
} else {
|
||||
let mut sum = quote!();
|
||||
sum.append_separated(this_info.iter().zip(&other_info).map(|(this, other)| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue