make clippy happy

This commit is contained in:
2024-05-26 23:16:25 +02:00
parent 54733b4869
commit e5fe5e3cf4
2 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -59,13 +59,13 @@ async fn main() -> anyhow::Result<()> {
result = wait_for_shutdown_signal() => { result = wait_for_shutdown_signal() => {
result.expect("error on waiting for shutdown signal"); true result.expect("error on waiting for shutdown signal"); true
}, },
_ = tokio::time::sleep(Duration::from_secs(sleep_duration)) => false, () = tokio::time::sleep(Duration::from_secs(sleep_duration)) => false,
}; };
if shutdown { if shutdown {
break Ok(()); break Ok(());
} }
if let Err(err) = disbahn_client.refresh().await { if let Err(err) = disbahn_client.refresh().await {
error!("{}", err) error!("{}", err);
} }
} }
} else { } else {
+4 -5
View File
@@ -52,7 +52,7 @@ impl DisbahnClient {
static RE_STRIKETHROUGH: &Lazy<Regex> = regex!(r#"<s\s*>((.|\n)*?)</s\s*>"#i); static RE_STRIKETHROUGH: &Lazy<Regex> = regex!(r#"<s\s*>((.|\n)*?)</s\s*>"#i);
static RE_NEWLINE: &Lazy<Regex> = regex!(r#"<br\s*/?>"#i); static RE_NEWLINE: &Lazy<Regex> = regex!(r#"<br\s*/?>"#i);
let input = RE_TIMES.replace(&input, ""); let input = RE_TIMES.replace(input, "");
let input = RE_BOLD.replace_all(&input, "**$1**"); let input = RE_BOLD.replace_all(&input, "**$1**");
let input = RE_ITALIC.replace_all(&input, "*$1*"); let input = RE_ITALIC.replace_all(&input, "*$1*");
let input = RE_STRIKETHROUGH.replace_all(&input, "~~$1~~"); let input = RE_STRIKETHROUGH.replace_all(&input, "~~$1~~");
@@ -102,8 +102,7 @@ impl DisbahnClient {
let icon = categories let icon = categories
.iter() .iter()
.find(|c| c.domain() == Some("icon")) .find(|c| c.domain() == Some("icon"))
.map(|c| c.name()) .map_or("", |c| c.name());
.unwrap_or("");
let icon_url = Self::icon_name_to_url(icon); let icon_url = Self::icon_name_to_url(icon);
let description = Self::html_to_discord_markdown( let description = Self::html_to_discord_markdown(
@@ -122,8 +121,8 @@ impl DisbahnClient {
.thumbnail(icon_url) .thumbnail(icon_url)
.colour(Self::icon_name_to_colour(icon)) .colour(Self::icon_name_to_colour(icon))
.description(description) .description(description)
.field("Beginn:", format!("<t:{}:F>", validity_begin), true) .field("Beginn:", format!("<t:{validity_begin}:F>"), true)
.field("Ende:", format!("<t:{}:F>", validity_end), true) .field("Ende:", format!("<t:{validity_end}:F>"), true)
.field("Hinweis:", include_str!("hint.txt"), false) .field("Hinweis:", include_str!("hint.txt"), false)
.timestamp(pub_datetime) .timestamp(pub_datetime)
.footer( .footer(