@@ -23,11 +23,8 @@ pub(super) fn get(
2323 let sysroot = match config {
2424 TargetTipleConfig :: Cargo ( sysroot, cargo_toml) => {
2525 match cargo_config_build_target ( cargo_toml, extra_env, sysroot) {
26- Ok ( it) => return Ok ( it) ,
27- Err ( e) => {
28- tracing:: warn!( "failed to run `cargo rustc --print cfg`, falling back to invoking rustc directly: {e}" ) ;
29- sysroot
30- }
26+ Some ( it) => return Ok ( it) ,
27+ None => sysroot,
3128 }
3229 }
3330 TargetTipleConfig :: Rustc ( sysroot) => sysroot,
@@ -58,7 +55,7 @@ fn cargo_config_build_target(
5855 cargo_toml : & ManifestPath ,
5956 extra_env : & FxHashMap < String , String > ,
6057 sysroot : & Sysroot ,
61- ) -> anyhow :: Result < Vec < String > > {
58+ ) -> Option < Vec < String > > {
6259 let mut cargo_config = sysroot. tool ( Tool :: Cargo ) ;
6360 cargo_config. envs ( extra_env) ;
6461 cargo_config
@@ -68,7 +65,9 @@ fn cargo_config_build_target(
6865 // if successful we receive `build.target = "target-triple"`
6966 // or `build.target = ["<target 1>", ..]`
7067 tracing:: debug!( "Discovering cargo config target by {:?}" , cargo_config) ;
71- utf8_stdout ( cargo_config) . and_then ( parse_output_cargo_config_build_target)
68+ // this might be `error: config value `build.target` is not set` in which case we
69+ // don't wanna log the error
70+ utf8_stdout ( cargo_config) . and_then ( parse_output_cargo_config_build_target) . ok ( )
7271}
7372
7473fn parse_output_cargo_config_build_target ( stdout : String ) -> anyhow:: Result < Vec < String > > {
0 commit comments