From c0572a78a245a6d0b8b29a53a000870e64c617e2 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sat, 4 Jan 2025 17:26:38 +0200 Subject: [PATCH] fix impl From for PostStatusRequest --- bot/src/mastodon/api.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot/src/mastodon/api.rs b/bot/src/mastodon/api.rs index 8151259..4dde661 100644 --- a/bot/src/mastodon/api.rs +++ b/bot/src/mastodon/api.rs @@ -26,24 +26,24 @@ impl From for PostStatusRequest { let mut status = String::new(); // The character budget for mastodon.social. - let mut character_budget = 500; + let mut character_budget: i32 = 500; let title = value.title.unwrap(); let summary = value.summary.unwrap(); let link = value.link.unwrap(); // reserve space for the link + one space - character_budget -= link.len() + 2; + character_budget -= link.len() as i32 + 2; // Push the title if character_budget > 0 { - status.push_str(title.get(0..character_budget).unwrap_or(title.as_str())); - character_budget -= title.len() + 2; + status.push_str(title.get(0..character_budget as usize).unwrap_or(title.as_str())); + character_budget -= title.len() as i32 + 2; status.push('\n') } // Push the summary if character_budget > 0 { - status.push_str(summary.get(0..character_budget).unwrap_or(summary.as_str())); + status.push_str(summary.get(0..character_budget as usize).unwrap_or(summary.as_str())); status.push('\n') }