From 456df3e5350136a6ad79f41913e05065250e04e1 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 13 Feb 2022 01:15:39 +0900 Subject: [PATCH] Use OneOrMany<&AnyString>::as_as_str() --- plume-common/src/activity_pub/mod.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index f4e681ef..cfc589d6 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -414,13 +414,7 @@ pub trait ToAsString { impl ToAsString for OneOrMany<&AnyString> { fn to_as_string(&self) -> Option { - self.as_one() - .and_then(|prop| prop.as_as_str()) - .or_else(|| { - self.as_many() - .and_then(|props| props.iter().next().and_then(|prop| prop.as_as_str())) - }) - .map(|s| s.to_string()) + self.as_as_str().map(|s| s.to_string()) } }