@@ -23,11 +23,8 @@ pub(super) fn get(
23
23
let sysroot = match config {
24
24
TargetTipleConfig :: Cargo ( sysroot, cargo_toml) => {
25
25
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,
31
28
}
32
29
}
33
30
TargetTipleConfig :: Rustc ( sysroot) => sysroot,
@@ -58,7 +55,7 @@ fn cargo_config_build_target(
58
55
cargo_toml : & ManifestPath ,
59
56
extra_env : & FxHashMap < String , String > ,
60
57
sysroot : & Sysroot ,
61
- ) -> anyhow :: Result < Vec < String > > {
58
+ ) -> Option < Vec < String > > {
62
59
let mut cargo_config = sysroot. tool ( Tool :: Cargo ) ;
63
60
cargo_config. envs ( extra_env) ;
64
61
cargo_config
@@ -68,7 +65,9 @@ fn cargo_config_build_target(
68
65
// if successful we receive `build.target = "target-triple"`
69
66
// or `build.target = ["<target 1>", ..]`
70
67
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 ( )
72
71
}
73
72
74
73
fn parse_output_cargo_config_build_target ( stdout : String ) -> anyhow:: Result < Vec < String > > {
0 commit comments