Do not coerce unknown numbers and preserve known units if present (#6961)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-16 10:58:21 +12:00
committed by GitHub
parent 48d6a21f0a
commit 9906c9947a
3 changed files with 65 additions and 15 deletions

View File

@ -102,7 +102,7 @@ impl TyF64 {
t => unreachable!("expected length, found {t:?}"),
};
assert_ne!(len, UnitLen::Unknown);
debug_assert_ne!(len, UnitLen::Unknown);
len.adjust_to(self.n, units).0
}
@ -114,7 +114,7 @@ impl TyF64 {
_ => unreachable!(),
};
assert_ne!(angle, UnitAngle::Unknown);
debug_assert_ne!(angle, UnitAngle::Unknown);
angle.adjust_to(self.n, UnitAngle::Degrees).0
}
@ -126,7 +126,7 @@ impl TyF64 {
_ => unreachable!(),
};
assert_ne!(angle, UnitAngle::Unknown);
debug_assert_ne!(angle, UnitAngle::Unknown);
angle.adjust_to(self.n, UnitAngle::Radians).0
}