style: simplify inline answer returns

This commit is contained in:
2026-09-24 20:57:08 +08:00
parent 8ae7d9947d
commit 66ec14662c
+2 -6
View File
@@ -228,12 +228,8 @@ async fn answer_inline_query(
caption.clone().into_owned(), caption.clone().into_owned(),
)); ));
} }
// Every item was skipped, or the post has no media at all: answer
// *empty* rather than leaving the query unanswered (a client keeps
// spinning on that, and the debounce's release re-runs the fetch on
// every keystroke).
answer(ctx.sender, query.id, results).await?; answer(ctx.sender, query.id, results).await?;
return Ok(true); Ok(true)
} }
Ok(None) | Err(_) => { Ok(None) | Err(_) => {
if let Err(e) = answer(ctx.sender, query.id, Vec::new()).await { if let Err(e) = answer(ctx.sender, query.id, Vec::new()).await {
@@ -243,7 +239,7 @@ async fn answer_inline_query(
); );
return Err(e); return Err(e);
} }
return Ok(true); Ok(true)
} }
} }
} }