Fix Clippy lints (#2320)

This commit is contained in:
bluebear94 2023-10-06 04:24:29 -04:00 committed by GitHub
parent df4beb6e15
commit bced71b250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 18 deletions

View File

@ -84,29 +84,13 @@ impl PartialEq<f64> for Scalar {
impl Ord for Scalar {
fn cmp(&self, other: &Self) -> Ordering {
self.partial_cmp(other).expect("float is NaN")
self.0.partial_cmp(&other.0).expect("float is NaN")
}
}
impl PartialOrd for Scalar {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.0.partial_cmp(&other.0)
}
fn lt(&self, other: &Self) -> bool {
self.0 < other.0
}
fn le(&self, other: &Self) -> bool {
self.0 <= other.0
}
fn gt(&self, other: &Self) -> bool {
self.0 > other.0
}
fn ge(&self, other: &Self) -> bool {
self.0 >= other.0
Some(self.cmp(other))
}
}

View File

@ -105,6 +105,8 @@ impl<T> Smart<T> {
where
T: Default,
{
// we want to do this; the Clippy lint is not type-aware
#[allow(clippy::unwrap_or_default)]
self.unwrap_or_else(T::default)
}
}

View File

@ -141,6 +141,8 @@ impl Stroke<Abs> {
/// Unpack the stroke, filling missing fields with the default values.
pub fn unwrap_or_default(self) -> FixedStroke {
// we want to do this; the Clippy lint is not type-aware
#[allow(clippy::unwrap_or_default)]
self.unwrap_or(FixedStroke::default())
}
}