@@ -165,7 +165,6 @@ async fn handle_rust_timer(
165
165
fn parse_queue_command ( body : & str ) -> Option < Result < QueueCommand , String > > {
166
166
let prefix = "@rust-timer" ;
167
167
let bot_line = body. lines ( ) . find_map ( |line| {
168
- let line = line. trim ( ) ;
169
168
line. find ( prefix)
170
169
. map ( |index| line[ index + prefix. len ( ) ..] . trim ( ) )
171
170
} ) ?;
@@ -187,8 +186,11 @@ fn parse_queue_command(body: &str) -> Option<Result<QueueCommand, String>> {
187
186
cmd. runs = Some ( runs as i32 ) ;
188
187
}
189
188
190
- if let Some ( ( key, _) ) = args. into_iter ( ) . next ( ) {
191
- return Some ( Err ( format ! ( "Unknown command argument {key}" ) ) ) ;
189
+ if !args. is_empty ( ) {
190
+ return Some ( Err ( format ! (
191
+ "Unknown command argument(s) `{}`" ,
192
+ args. into_keys( ) . collect:: <Vec <_>>( ) . join( "," )
193
+ ) ) ) ;
192
194
}
193
195
194
196
Some ( Ok ( cmd) )
@@ -295,7 +297,7 @@ Going to do perf runs for a few of these:
295
297
#[ test]
296
298
fn queue_command_unknown_arg ( ) {
297
299
insta:: assert_compact_debug_snapshot!( parse_queue_command( "@rust-timer queue foo=bar" ) ,
298
- @r###"Some(Err("Unknown command argument foo"))"### ) ;
300
+ @r###"Some(Err("Unknown command argument(s) ` foo` "))"### ) ;
299
301
}
300
302
301
303
#[ test]
@@ -351,4 +353,10 @@ Going to do perf runs for a few of these:
351
353
insta:: assert_compact_debug_snapshot!( parse_queue_command( "@bors try @rust-timer queue include=foo,bar" ) ,
352
354
@r###"Some(Ok(QueueCommand { include: Some("foo,bar"), exclude: None, runs: None }))"### ) ;
353
355
}
356
+
357
+ #[ test]
358
+ fn queue_command_parameter_order ( ) {
359
+ insta:: assert_compact_debug_snapshot!( parse_queue_command( "@rust-timer queue runs=3 exclude=c,a include=b" ) ,
360
+ @r###"Some(Ok(QueueCommand { include: Some("b"), exclude: Some("c,a"), runs: Some(3) }))"### ) ;
361
+ }
354
362
}
0 commit comments