From d0f582b98712d967b2f95d0405886d063bd89468 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sun, 6 Apr 2025 00:57:56 +0200 Subject: Get stricter clippy --- src/post.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/post.rs') diff --git a/src/post.rs b/src/post.rs index 97c49f1..20322b4 100644 --- a/src/post.rs +++ b/src/post.rs @@ -16,9 +16,12 @@ impl Post { let posts_collection = posts.iter().map(Post::to_template_value).collect(); context.insert("has_posts".to_string(), Value::Bool(!posts.is_empty())); + + // If you really reach over 18 quintillion posts, I guess you can send + // me a bug-request via e-mail. context.insert( "posts_length".to_string(), - Value::Unsigned(posts.len().try_into().unwrap()), + Value::Unsigned(posts.len().try_into().unwrap_or(u64::MAX)), ); context.insert("posts".to_string(), Value::Collection(posts_collection)); @@ -55,7 +58,7 @@ impl Post { self.raw .lines() .next() - .unwrap() + .unwrap_or("") .replace('#', "") .replace('&', "&") .trim() -- cgit