aboutsummaryrefslogtreecommitdiff
path: root/src/post.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-04-06 00:57:56 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-04-06 00:57:56 +0200
commitd0f582b98712d967b2f95d0405886d063bd89468 (patch)
treecc644c21278d336772557366bcdd3e46b22065db /src/post.rs
parent8b3b94a38b443c50afc5b42cca45db7c18ce280d (diff)
Get stricter clippy
Diffstat (limited to 'src/post.rs')
-rw-r--r--src/post.rs7
1 files changed, 5 insertions, 2 deletions
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('&', "&amp;")
.trim()