Skip to content

Commit 89219ff

Browse files
committed
move install to parse_inner
1 parent 924912c commit 89219ff

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use crate::core::config::toml::TomlConfig;
3838
use crate::core::config::toml::build::{Build, Tool};
3939
use crate::core::config::toml::change_id::ChangeId;
4040
use crate::core::config::toml::dist::Dist;
41+
use crate::core::config::toml::install::Install;
4142
use crate::core::config::toml::rust::{
4243
LldMode, RustOptimize, check_incompatible_options_for_ci_rustc, validate_codegen_backends,
4344
};
@@ -906,7 +907,16 @@ impl Config {
906907
// Verbose flag is a good default for `rust.verbose-tests`.
907908
config.verbose_tests = config.is_verbose();
908909

909-
config.apply_install_config(toml.install);
910+
if let Some(install) = toml.install {
911+
let Install { prefix, sysconfdir, docdir, bindir, libdir, mandir, datadir } = install;
912+
config.prefix = prefix.map(PathBuf::from);
913+
config.sysconfdir = sysconfdir.map(PathBuf::from);
914+
config.datadir = datadir.map(PathBuf::from);
915+
config.docdir = docdir.map(PathBuf::from);
916+
set(&mut config.bindir, bindir.map(PathBuf::from));
917+
config.libdir = libdir.map(PathBuf::from);
918+
config.mandir = mandir.map(PathBuf::from);
919+
}
910920

911921
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
912922
let ci_channel = file_content.trim_end();

src/bootstrap/src/core/config/toml/install.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
99
use serde::{Deserialize, Deserializer};
1010

11+
use crate::core::config::Merge;
1112
use crate::core::config::toml::ReplaceOpt;
12-
use crate::core::config::{Merge, set};
13-
use crate::{Config, HashSet, PathBuf, define_config, exit};
13+
use crate::{HashSet, PathBuf, define_config, exit};
1414

1515
define_config! {
1616
/// TOML representation of various global install decisions.
@@ -24,20 +24,3 @@ define_config! {
2424
datadir: Option<String> = "datadir",
2525
}
2626
}
27-
28-
impl Config {
29-
/// Applies installation-related configuration from the `Install` struct
30-
/// to the global `Config` structure.
31-
pub fn apply_install_config(&mut self, toml_install: Option<Install>) {
32-
if let Some(install) = toml_install {
33-
let Install { prefix, sysconfdir, docdir, bindir, libdir, mandir, datadir } = install;
34-
self.prefix = prefix.map(PathBuf::from);
35-
self.sysconfdir = sysconfdir.map(PathBuf::from);
36-
self.datadir = datadir.map(PathBuf::from);
37-
self.docdir = docdir.map(PathBuf::from);
38-
set(&mut self.bindir, bindir.map(PathBuf::from));
39-
self.libdir = libdir.map(PathBuf::from);
40-
self.mandir = mandir.map(PathBuf::from);
41-
}
42-
}
43-
}

0 commit comments

Comments
 (0)