about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2025-01-01 04:51:05 +0300
committerVika <vika@fireburn.ru>2025-01-01 04:51:05 +0300
commit01c4c798aeb6fe9e12af14c2a96f5e5279f49cdd (patch)
tree1ab8cf73796be0a2c0e3a6851d4fda4fd1fe4d72
parent15404778b3e01c90111c5eccb9fd96644a257d49 (diff)
downloadkittybox-01c4c798aeb6fe9e12af14c2a96f5e5279f49cdd.tar.zst
micropub: Don't map-n-filter where we can filter_map
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
-rw-r--r--src/micropub/mod.rs3
1 files changed, 1 insertions, 2 deletions
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<D: 'static + Storage>(
         .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