Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ce27ea9

Browse files
bootstrap: Demagic a repeating path
1 parent bc37f9e commit ce27ea9

File tree

1 file changed

+4
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+4
-2
lines changed

src/bootstrap/src/core/build_steps/setup.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ pub enum Profile {
3131
None,
3232
}
3333

34+
static PROFILE_DIR: &str = "src/bootstrap/defaults";
35+
3436
/// A list of historical hashes of `src/etc/rust_analyzer_settings.json`.
3537
/// New entries should be appended whenever this is updated so we can detect
3638
/// outdated vs. user-modified settings files.
@@ -47,7 +49,7 @@ static RUST_ANALYZER_SETTINGS: &str = include_str!("../../../../etc/rust_analyze
4749

4850
impl Profile {
4951
fn include_path(&self, src_path: &Path) -> PathBuf {
50-
PathBuf::from(format!("{}/src/bootstrap/defaults/config.{}.toml", src_path.display(), self))
52+
PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self))
5153
}
5254

5355
pub fn all() -> impl Iterator<Item = Self> {
@@ -227,7 +229,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {
227229

228230
let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id;
229231
let settings = format!(
230-
"# Includes one of the default files in src/bootstrap/defaults\n\
232+
"# Includes one of the default files in {PROFILE_DIR}\n\
231233
profile = \"{profile}\"\n\
232234
change-id = {latest_change_id}\n"
233235
);

0 commit comments

Comments
 (0)