Replace dirty unwrap() with expect("TODO")

This makes it obvious where better error handling is still needed.
This commit is contained in:
Rahix 2025-12-09 15:29:21 +01:00
parent 983ceb2076
commit b66e8c8d9c
5 changed files with 25 additions and 15 deletions

View file

@ -28,7 +28,7 @@ pub async fn make_bot_comment(
.await?;
Ok(BotCommentInfo {
id: res.id.unwrap(),
id: res.id.expect("TODO"),
body: initial_message.to_owned(),
})
}
@ -55,11 +55,11 @@ pub async fn find_bot_comment(
let maybe_bot_comment = comments
.iter()
.rev()
.find(|comment| comment.user.as_ref().unwrap().id == Some(-2));
.find(|comment| comment.user.as_ref().expect("TODO").id == Some(-2));
Ok(maybe_bot_comment.map(|c| BotCommentInfo {
body: c.body.clone().unwrap_or("".to_owned()),
id: c.id.unwrap(),
id: c.id.expect("TODO"),
}))
}
@ -155,7 +155,7 @@ pub async fn remove_stale_label(ctx: &crate::Context, issue_number: u64) -> anyh
.iter()
.filter(|l| l.name.as_deref() == Some("Stale"))
.next()
.map(|l| l.id.unwrap());
.map(|l| l.id.expect("TODO"));
if let Some(stale_label_id) = stale_label_id {
log::info!("Removing `Stale` label from issue #{issue_number}...");