From be0ba801405ef8f6663c68577ed4f44fa621ba7e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Aug 2025 12:45:24 +0200 Subject: [PATCH] bin/issue: Optimize collecting of patches into Vec Signed-off-by: Matthias Beyer --- bin/commands/issue.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/commands/issue.rs b/bin/commands/issue.rs index 5b72e3cd..a232307b 100644 --- a/bin/commands/issue.rs +++ b/bin/commands/issue.rs @@ -226,16 +226,15 @@ pub async fn run(options: Options, ctx: impl terminal::Context) -> anyhow::Resul eprint!("{selection}"); } else if let Some(selection) = selection { - let mut args = vec![]; + let args = [ + selection.operation.as_ref().cloned(), + selection.ids.first().map(ToString::to_string), + ] + .into_iter() + .flatten() + .map(OsString::from) + .collect::>(); - if let Some(operation) = selection.operation { - args.push(operation.to_string()); - } - if let Some(id) = selection.ids.first() { - args.push(format!("{id}")); - } - - let args = args.into_iter().map(OsString::from).collect::>(); let _ = crate::terminal::run_rad(Some("issue"), &args); } }