diff options
Diffstat (limited to 'src/database/redis/mod.rs')
-rw-r--r-- | src/database/redis/mod.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs index 5a6b70d..cf94386 100644 --- a/src/database/redis/mod.rs +++ b/src/database/redis/mod.rs @@ -165,17 +165,13 @@ impl Storage for RedisStorage { .map(|channel| { self.get_post(channel).map(|result| result.unwrap()).map( |post: Option<serde_json::Value>| { - if let Some(post) = post { - Some(MicropubChannel { - uid: post["properties"]["uid"][0].as_str().unwrap().to_string(), - name: post["properties"]["name"][0] - .as_str() - .unwrap() - .to_string(), - }) - } else { - None - } + post.map(|post| MicropubChannel { + uid: post["properties"]["uid"][0].as_str().unwrap().to_string(), + name: post["properties"]["name"][0] + .as_str() + .unwrap() + .to_string(), + }) }, ) }) @@ -183,7 +179,7 @@ impl Storage for RedisStorage { ) .await .into_iter() - .filter_map(|chan| chan) + .flatten() .collect::<Vec<_>>()) } |