Fix clippy lints

This commit is contained in:
Rahix 2025-12-09 16:48:42 +01:00
parent c11026c5be
commit be7f305a6b
6 changed files with 23 additions and 23 deletions

View file

@ -57,14 +57,14 @@ pub async fn find_bot_comment(
.rev()
.find(|comment| comment.user.as_ref().and_then(|u| u.id) == Some(-2));
Ok(maybe_bot_comment
maybe_bot_comment
.map(|c| -> anyhow::Result<_> {
Ok(BotCommentInfo {
body: c.body.clone().unwrap_or("".to_owned()),
id: c.id.context("Missing id for the bot comment")?,
})
})
.transpose()?)
.transpose()
}
/// Find existing bot comment or create a new one.
@ -115,12 +115,12 @@ pub async fn update_bot_comment_from_subtree(
subtree: &crate::tree::Subtree<'_>,
hash: &str,
) -> anyhow::Result<()> {
let mut mermaid = subtree.to_mermaid(&ctx.repo_url.to_string(), false);
let mut mermaid = subtree.to_mermaid(ctx.repo_url.as_ref(), false);
// When the mermaid graph gets too big, regenerate a simplified version.
if mermaid.len() > 4990 {
log::info!("Mermaid graph is too big, generating simplified version...");
mermaid = subtree.to_mermaid(&ctx.repo_url.to_string(), true);
mermaid = subtree.to_mermaid(ctx.repo_url.as_ref(), true);
}
let full_text = if mermaid.len() > 4990 {
@ -143,7 +143,7 @@ _Sorry, the partial techtree is still too big to be displayed for this element..
)
};
update_bot_comment(&ctx, id, full_text).await?;
update_bot_comment(ctx, id, full_text).await?;
Ok(())
}
@ -157,8 +157,7 @@ pub async fn remove_stale_label(ctx: &crate::Context, issue_number: u64) -> anyh
let stale_label_id = labels
.iter()
.filter(|l| l.name.as_deref() == Some("Stale"))
.next()
.find(|l| l.name.as_deref() == Some("Stale"))
.map(|l| l.id.ok_or(anyhow::anyhow!("`Stale` label has no ID")))
.transpose()?;