@@ -67,15 +67,10 @@ pub(super) fn load_target_cfgs(config: &Config) -> CargoResult<Vec<(String, Targ
67
67
/// Returns true if the `[target]` table should be applied to host targets.
68
68
pub ( super ) fn get_target_applies_to_host ( config : & Config ) -> CargoResult < bool > {
69
69
if config. cli_unstable ( ) . target_applies_to_host {
70
- let target_applies_to_host = config. get :: < bool > ( "target-applies-to-host" ) ;
71
- if target_applies_to_host. is_ok ( ) {
72
- Ok ( target_applies_to_host. unwrap ( ) )
70
+ if let Ok ( target_applies_to_host) = config. get :: < bool > ( "target-applies-to-host" ) {
71
+ Ok ( target_applies_to_host)
73
72
} else {
74
- if config. cli_unstable ( ) . host_config {
75
- Ok ( false )
76
- } else {
77
- Ok ( true )
78
- }
73
+ Ok ( !config. cli_unstable ( ) . host_config )
79
74
}
80
75
} else {
81
76
if config. cli_unstable ( ) . host_config {
@@ -91,9 +86,10 @@ pub(super) fn get_target_applies_to_host(config: &Config) -> CargoResult<bool> {
91
86
/// Loads a single `[host]` table for the given triple.
92
87
pub ( super ) fn load_host_triple ( config : & Config , triple : & str ) -> CargoResult < TargetConfig > {
93
88
if config. cli_unstable ( ) . host_config {
94
- let host_triple_key = ConfigKey :: from_str ( & format ! ( "host.{}" , triple) ) ;
89
+ let host_triple_prefix = format ! ( "host.{}" , triple) ;
90
+ let host_triple_key = ConfigKey :: from_str ( & host_triple_prefix) ;
95
91
let host_prefix = match config. get_cv ( & host_triple_key) ? {
96
- Some ( _) => format ! ( "host.{}" , triple ) ,
92
+ Some ( _) => host_triple_prefix ,
97
93
None => "host" . to_string ( ) ,
98
94
} ;
99
95
load_config_table ( config, & host_prefix)
0 commit comments