@@ -33,6 +33,14 @@ use crate::{
33
33
DropErrorDetailsExt , TaskAbortExt as _,
34
34
} ;
35
35
36
+ macro_rules! kvs {
37
+ ( $( $k: expr => $v: expr) ,+$( , ) ?) => {
38
+ [
39
+ $( ( Into :: into( $k) , Into :: into( $v) ) , ) +
40
+ ] . into_iter( )
41
+ } ;
42
+ }
43
+
36
44
pub mod limits;
37
45
38
46
#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -393,7 +401,7 @@ impl LowerRequest for ExecuteRequest {
393
401
394
402
let mut envs = HashMap :: new ( ) ;
395
403
if self . backtrace {
396
- envs. insert ( "RUST_BACKTRACE" . to_owned ( ) , "1" . to_owned ( ) ) ;
404
+ envs. extend ( kvs ! ( "RUST_BACKTRACE" => "1" ) ) ;
397
405
}
398
406
399
407
ExecuteCommandRequest {
@@ -522,7 +530,7 @@ impl LowerRequest for CompileRequest {
522
530
}
523
531
let mut envs = HashMap :: new ( ) ;
524
532
if self . backtrace {
525
- envs. insert ( "RUST_BACKTRACE" . to_owned ( ) , "1" . to_owned ( ) ) ;
533
+ envs. extend ( kvs ! ( "RUST_BACKTRACE" => "1" ) ) ;
526
534
}
527
535
528
536
ExecuteCommandRequest {
@@ -685,7 +693,7 @@ impl LowerRequest for MiriRequest {
685
693
ExecuteCommandRequest {
686
694
cmd : "cargo" . to_owned ( ) ,
687
695
args : vec ! [ "miri-playground" . to_owned( ) ] ,
688
- envs : HashMap :: from_iter ( [ ( "MIRIFLAGS" . to_owned ( ) , miriflags) ] ) ,
696
+ envs : kvs ! ( "MIRIFLAGS" => miriflags) . collect ( ) ,
689
697
cwd : None ,
690
698
}
691
699
}
0 commit comments