@@ -12,6 +12,7 @@ use std::{
1212
1313use crossbeam_channel:: { never, select, unbounded, Receiver , Sender } ;
1414use paths:: AbsPathBuf ;
15+ use rustc_hash:: FxHashMap ;
1516use serde:: Deserialize ;
1617use stdx:: { process:: streaming_output, JodChild } ;
1718
@@ -30,18 +31,20 @@ pub enum FlycheckConfig {
3031 all_features : bool ,
3132 features : Vec < String > ,
3233 extra_args : Vec < String > ,
34+ extra_env : FxHashMap < String , String > ,
3335 } ,
3436 CustomCommand {
3537 command : String ,
3638 args : Vec < String > ,
39+ extra_env : FxHashMap < String , String > ,
3740 } ,
3841}
3942
4043impl fmt:: Display for FlycheckConfig {
4144 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4245 match self {
4346 FlycheckConfig :: CargoCommand { command, .. } => write ! ( f, "cargo {}" , command) ,
44- FlycheckConfig :: CustomCommand { command, args } => {
47+ FlycheckConfig :: CustomCommand { command, args, .. } => {
4548 write ! ( f, "{} {}" , command, args. join( " " ) )
4649 }
4750 }
@@ -256,6 +259,7 @@ impl FlycheckActor {
256259 all_features,
257260 extra_args,
258261 features,
262+ extra_env,
259263 } => {
260264 let mut cmd = Command :: new ( toolchain:: cargo ( ) ) ;
261265 cmd. arg ( command) ;
@@ -281,11 +285,13 @@ impl FlycheckActor {
281285 }
282286 }
283287 cmd. args ( extra_args) ;
288+ cmd. envs ( extra_env) ;
284289 cmd
285290 }
286- FlycheckConfig :: CustomCommand { command, args } => {
291+ FlycheckConfig :: CustomCommand { command, args, extra_env } => {
287292 let mut cmd = Command :: new ( command) ;
288293 cmd. args ( args) ;
294+ cmd. envs ( extra_env) ;
289295 cmd
290296 }
291297 } ;
0 commit comments