about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-04-21 13:52:42 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-04-21 13:59:34 -0700
commitce27ea935edd4cc04455e6abfdc8ba8ed86be451 (patch)
treeab37847008910cff757ccd3cd1e40f2148277682 /src
parentbc37f9e2040235a4e6b8bed6c6db4f064fea15cc (diff)
downloadrust-ce27ea935edd4cc04455e6abfdc8ba8ed86be451.tar.gz
rust-ce27ea935edd4cc04455e6abfdc8ba8ed86be451.zip
bootstrap: Demagic a repeating path
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 6b2b7e5dcac..a01d20e8c21 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -31,6 +31,8 @@ pub enum Profile {
     None,
 }
 
+static PROFILE_DIR: &str = "src/bootstrap/defaults";
+
 /// A list of historical hashes of `src/etc/rust_analyzer_settings.json`.
 /// New entries should be appended whenever this is updated so we can detect
 /// outdated vs. user-modified settings files.
@@ -47,7 +49,7 @@ static RUST_ANALYZER_SETTINGS: &str = include_str!("../../../../etc/rust_analyze
 
 impl Profile {
     fn include_path(&self, src_path: &Path) -> PathBuf {
-        PathBuf::from(format!("{}/src/bootstrap/defaults/config.{}.toml", src_path.display(), self))
+        PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self))
     }
 
     pub fn all() -> impl Iterator<Item = Self> {
@@ -227,7 +229,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {
 
     let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id;
     let settings = format!(
-        "# Includes one of the default files in src/bootstrap/defaults\n\
+        "# Includes one of the default files in {PROFILE_DIR}\n\
     profile = \"{profile}\"\n\
     change-id = {latest_change_id}\n"
     );