@@ -170,6 +170,10 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
170170 . last ( true )
171171 . num_args ( 1 ..)
172172 . help ( "The arguments to be proxied to the tool" ) ,
173+ // We look at .cargo/config.toml even when we don't build the binary.
174+ Arg :: new ( "manifest-path" )
175+ . long ( "manifest-path" )
176+ . help ( "Path to Cargo.tom" ) ,
173177 ] )
174178 . after_help ( after_help) ;
175179
@@ -223,9 +227,6 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
223227 . long ( "profile" )
224228 . value_name ( "PROFILE-NAME" )
225229 . help ( "Build artifacts with the specified profile" ) ,
226- Arg :: new ( "manifest-path" )
227- . long ( "manifest-path" )
228- . help ( "Path to Cargo.tom" ) ,
229230 Arg :: new ( "features" )
230231 . long ( "features" )
231232 . short ( 'F' )
@@ -280,16 +281,18 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
280281
281282pub fn run ( tool : Tool , matches : ArgMatches ) -> Result < i32 > {
282283 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 ) ;
284+ if tool. needs_build ( ) {
285+ if let Some ( features) = matches. get_many :: < String > ( "features" ) {
286+ metadata_command. features ( CargoOpt :: SomeFeatures (
287+ features. map ( |s| s. to_owned ( ) ) . collect ( ) ,
288+ ) ) ;
289+ }
290+ if matches. get_flag ( "no-default-features" ) {
291+ metadata_command. features ( CargoOpt :: NoDefaultFeatures ) ;
292+ }
293+ if matches. get_flag ( "all-features" ) {
294+ metadata_command. features ( CargoOpt :: AllFeatures ) ;
295+ }
293296 }
294297 if let Some ( path) = matches. get_one :: < String > ( "manifest-path" ) {
295298 metadata_command. manifest_path ( path) ;
0 commit comments