From 658f832d0848869a089d0ca947bf9caaab27003b Mon Sep 17 00:00:00 2001 From: asonix Date: Thu, 6 Jul 2023 11:41:54 -0500 Subject: [PATCH] Clippy nits --- src/actor.rs | 3 +-- src/primitives/unit.rs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index fad5df2..aba9cc4 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -866,8 +866,7 @@ pub trait ApActorExt: AsApActor { endpoints .nonstandard .values() - .map(|v| check_opt(v, authority_opt.as_ref())) - .collect::>()?; + .try_for_each(|v| check_opt(v, authority_opt.as_ref()))?; return Ok(Some(endpoints)); } diff --git a/src/primitives/unit.rs b/src/primitives/unit.rs index 555361f..634e64c 100644 --- a/src/primitives/unit.rs +++ b/src/primitives/unit.rs @@ -222,7 +222,16 @@ impl From<&str> for Unit { /// A list of units of length that represent valid units for certain ActivityStreams objects #[derive( - Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, serde::Deserialize, serde::Serialize, + Clone, + Debug, + Default, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, + serde::Deserialize, + serde::Serialize, )] #[serde(untagged)] enum Length { @@ -238,6 +247,7 @@ enum Length { #[serde(rename = "km")] Kilometers, + #[default] #[serde(rename = "m")] Meters, } @@ -276,12 +286,6 @@ impl Length { } } -impl Default for Length { - fn default() -> Self { - Length::Meters - } -} - impl std::str::FromStr for Length { type Err = LengthError;