From 01c4c798aeb6fe9e12af14c2a96f5e5279f49cdd Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 1 Jan 2025 04:51:05 +0300 Subject: micropub: Don't map-n-filter where we can filter_map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The channel iterator did its filtering of non-strings with an `unwrap_or()`, but we can safely get rid of it, since `<&'a Value>::as_str()` returns `Option<&'a str>`. Change-Id: Ie7a74247db4709e2aafd6bcd3623fab592bede81 --- src/micropub/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/micropub') diff --git a/src/micropub/mod.rs b/src/micropub/mod.rs index 663702f..f5cb5b9 100644 --- a/src/micropub/mod.rs +++ b/src/micropub/mod.rs @@ -281,8 +281,7 @@ pub(crate) async fn _post( .as_array() .unwrap() .iter() - .map(|i| i.as_str().unwrap_or("")) - .filter(|i| !i.is_empty()); + .filter_map(|i| i.as_str()); let default_channel = user .me -- cgit 1.4.1