@@ -1191,37 +1191,39 @@ impl Config {
1191
1191
}
1192
1192
}
1193
1193
1194
- pub fn parse(flags: Flags) -> Config {
1195
- #[cfg(test)]
1196
- fn get_toml(_: &Path) -> TomlConfig {
1197
- TomlConfig::default()
1198
- }
1194
+ #[cfg(test)]
1195
+ fn get_toml(_: &Path) -> TomlConfig {
1196
+ TomlConfig::default()
1197
+ }
1199
1198
1200
- #[cfg(not(test))]
1201
- fn get_toml(file: &Path) -> TomlConfig {
1202
- let contents =
1203
- t!(fs::read_to_string(file), format!("config file {} not found", file.display()));
1204
- // Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
1205
- // TomlConfig and sub types to be monomorphized 5x by toml.
1206
- toml::from_str(&contents)
1207
- .and_then(|table: toml::Value| TomlConfig::deserialize(table))
1208
- .unwrap_or_else(|err| {
1209
- if let Ok(Some(changes)) = toml::from_str(&contents)
1210
- .and_then(|table: toml::Value| ChangeIdWrapper::deserialize(table)).map(|change_id| change_id.inner.map(crate::find_recent_config_change_ids ))
1211
- {
1212
- if !changes.is_empty() {
1213
- println!(
1214
- "WARNING: There have been changes to x.py since you last updated:\n{}",
1215
- crate::human_readable_changes(& changes)
1216
- );
1217
- }
1199
+ #[cfg(not(test))]
1200
+ fn get_toml(file: &Path) -> TomlConfig {
1201
+ let contents =
1202
+ t!(fs::read_to_string(file), format!("config file {} not found", file.display()));
1203
+ // Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
1204
+ // TomlConfig and sub types to be monomorphized 5x by toml.
1205
+ toml::from_str(&contents)
1206
+ .and_then(|table: toml::Value| TomlConfig::deserialize(table))
1207
+ .unwrap_or_else(|err| {
1208
+ if let Ok(Some(changes)) = toml::from_str(&contents)
1209
+ .and_then(|table: toml::Value| ChangeIdWrapper::deserialize(table))
1210
+ .map(|change_id| change_id.inner.map(crate::find_recent_config_change_ids))
1211
+ {
1212
+ if !changes.is_empty() {
1213
+ println!(
1214
+ "WARNING: There have been changes to x.py since you last updated:\n{}",
1215
+ crate::human_readable_changes(&changes)
1216
+ );
1218
1217
}
1218
+ }
1219
1219
1220
- eprintln!("failed to parse TOML configuration '{}': {err}", file.display());
1221
- exit!(2);
1222
- })
1223
- }
1224
- Self::parse_inner(flags, get_toml)
1220
+ eprintln!("failed to parse TOML configuration '{}': {err}", file.display());
1221
+ exit!(2);
1222
+ })
1223
+ }
1224
+
1225
+ pub fn parse(flags: Flags) -> Config {
1226
+ Self::parse_inner(flags, Self::get_toml)
1225
1227
}
1226
1228
1227
1229
pub(crate) fn parse_inner(mut flags: Flags, get_toml: impl Fn(&Path) -> TomlConfig) -> Config {
@@ -2656,21 +2658,21 @@ fn check_incompatible_options_for_ci_rustc(rust: &Rust) -> Result<(), String> {
2656
2658
macro_rules! err {
2657
2659
($name:expr) => {
2658
2660
if $name.is_some() {
2659
- return Err(format!(
2660
- "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`.",
2661
+ return Err(format!(
2662
+ "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`.",
2661
2663
stringify!($name).replace("_", "-")
2662
- ));
2664
+ ));
2663
2665
}
2664
2666
};
2665
2667
}
2666
2668
2667
2669
macro_rules! warn {
2668
2670
($name:expr) => {
2669
2671
if $name.is_some() {
2670
- println!(
2671
- "WARNING: `rust.{}` has no effect with `rust.download-rustc`.",
2672
+ println!(
2673
+ "WARNING: `rust.{}` has no effect with `rust.download-rustc`.",
2672
2674
stringify!($name).replace("_", "-")
2673
- );
2675
+ );
2674
2676
}
2675
2677
};
2676
2678
}
0 commit comments