From 3cb1169dcb225aeeae09c6af198962a4b2e7785f Mon Sep 17 00:00:00 2001 From: Steve Cook Date: Sat, 16 Jul 2022 01:02:42 -0400 Subject: [PATCH] Fix message format parsing --- src/main.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index e3c480d..5ca3595 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,17 +22,12 @@ fn main() { .iter() .position(|s| s.starts_with("--message-format")) { - input.cargo_opts.remove(pos); - let format = if let Some((_, format)) = input - .cargo_opts - .get(pos) - .unwrap() - .to_string() - .split_once('=') + let arg = input.cargo_opts.remove(pos); + let format = if let Some((_, format)) = arg.split_once('=') { format.to_string() } else { - input.cargo_opts.remove(pos).to_string() + arg.to_string() }; if !format.starts_with("json") { eprintln!("error: non-JSON `message-format` is not supported");