diff --git a/cave/src/store.rs b/cave/src/store.rs index 26438f2..2047c90 100644 --- a/cave/src/store.rs +++ b/cave/src/store.rs @@ -160,20 +160,14 @@ impl Store { return; } - let host = match post.url_host() { - Some(host) => host, - None => { - tracing::warn!("no url_host"); - return; - }, + let Some(host) = post.url_host() else { + tracing::warn!("no url_host"); + return; }; - let timestamp = match post.timestamp() { - Some(timestamp) => timestamp, - None => { - tracing::warn!("no timestamp"); - return; - } + let Some(timestamp) = post.timestamp() else { + tracing::warn!("no timestamp"); + return; }; let hour = timestamp.to_utc().timestamp() as u64 / 3600; let until = current_hour(); @@ -389,9 +383,7 @@ impl Store { let mut results = Vec::with_capacity(names.len()); for name in names { - let hash_values = if let Some(Value::Bulk(hash_values)) = values.next() { - hash_values - } else { + let Some(Value::Bulk(hash_values)) = values.next() else { panic!("hash_values"); }; let hash_values = hash_values.iter() diff --git a/sieve/src/main.rs b/sieve/src/main.rs index 161af00..a02ecc8 100644 --- a/sieve/src/main.rs +++ b/sieve/src/main.rs @@ -141,9 +141,7 @@ async fn main() { let author: activitypub::Actor = if let Some(author_url) = &post.attributed_to { if let Ok(url) = Url::parse(author_url) { - let host = if let Some(host) = url.host_str() { - host - } else { + let Some(host) = url.host_str() else { tracing::error!("No host in author {author_url}"); return; }; @@ -183,9 +181,7 @@ async fn main() { } else { "update" }.to_string(); - let encodable_post = if let Ok(post) = feed::EncodablePost::from_post(event_type, feed_post) { - post - } else { + let Ok(encodable_post) = feed::EncodablePost::from_post(event_type, feed_post) else { tracing::error!("Cannot serialize post {id}"); metrics::counter!("sieve_activity", 1, "type" => "serialize_error"); return;