@@ -280,16 +280,18 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
280280
281281pub fn run ( tool : Tool , matches : ArgMatches ) -> Result < i32 > {
282282 let mut metadata_command = MetadataCommand :: new ( ) ;
283- if let Some ( features) = matches. get_many :: < String > ( "features" ) {
284- metadata_command. features ( CargoOpt :: SomeFeatures (
285- features. map ( |s| s. to_owned ( ) ) . collect ( ) ,
286- ) ) ;
287- }
288- if matches. get_flag ( "no-default-features" ) {
289- metadata_command. features ( CargoOpt :: NoDefaultFeatures ) ;
290- }
291- if matches. get_flag ( "all-features" ) {
292- metadata_command. features ( CargoOpt :: AllFeatures ) ;
283+ if tool. needs_build ( ) {
284+ if let Some ( features) = matches. get_many :: < String > ( "features" ) {
285+ metadata_command. features ( CargoOpt :: SomeFeatures (
286+ features. map ( |s| s. to_owned ( ) ) . collect ( ) ,
287+ ) ) ;
288+ }
289+ if matches. get_flag ( "no-default-features" ) {
290+ metadata_command. features ( CargoOpt :: NoDefaultFeatures ) ;
291+ }
292+ if matches. get_flag ( "all-features" ) {
293+ metadata_command. features ( CargoOpt :: AllFeatures ) ;
294+ }
293295 }
294296 if let Some ( path) = matches. get_one :: < String > ( "manifest-path" ) {
295297 metadata_command. manifest_path ( path) ;
@@ -526,7 +528,7 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
526528 cargo. args ( [ "--features" , feature] ) ;
527529 }
528530 }
529- if matches. get_flag ( "no-default-features" ) {
531+ if matches. get_flag ( "no-default-features" ) {
530532 cargo. arg ( "--no-default-features" ) ;
531533 }
532534 if matches. get_flag ( "all-features" ) {
0 commit comments