Skip to content

Rename src/etc/vscode_settings.json to rust_analyzer_settings.json #108618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/bootstrap/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pub enum Profile {
None,
}

/// A list of historical hashes of `src/etc/vscode_settings.json`.
/// 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.
static SETTINGS_HASHES: &[&str] = &[
"ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8",
"56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922",
"af1b5efe196aed007577899db9dae15d6dbc923d6fa42fa0934e68617ba9bbe0",
];
static VSCODE_SETTINGS: &str = include_str!("../etc/vscode_settings.json");
static RUST_ANALYZER_SETTINGS: &str = include_str!("../etc/rust_analyzer_settings.json");

impl Profile {
fn include_path(&self, src_path: &Path) -> PathBuf {
Expand Down Expand Up @@ -489,7 +489,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
Ok(())
}

/// Sets up or displays `src/etc/vscode_settings.json`
/// Sets up or displays `src/etc/rust_analyzer_settings.json`
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct Vscode;

Expand Down Expand Up @@ -580,10 +580,10 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
}
_ => "Created",
};
fs::write(&vscode_settings, &VSCODE_SETTINGS)?;
fs::write(&vscode_settings, &RUST_ANALYZER_SETTINGS)?;
println!("{verb} `.vscode/settings.json`");
} else {
println!("\n{VSCODE_SETTINGS}");
println!("\n{RUST_ANALYZER_SETTINGS}");
}
Ok(())
}
6 changes: 3 additions & 3 deletions src/bootstrap/setup/tests.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use super::{SETTINGS_HASHES, VSCODE_SETTINGS};
use super::{RUST_ANALYZER_SETTINGS, SETTINGS_HASHES};
use sha2::Digest;

#[test]
fn check_matching_settings_hash() {
let mut hasher = sha2::Sha256::new();
hasher.update(&VSCODE_SETTINGS);
hasher.update(&RUST_ANALYZER_SETTINGS);
let hash = hex::encode(hasher.finalize().as_slice());
assert_eq!(
&hash,
SETTINGS_HASHES.last().unwrap(),
"Update `SETTINGS_HASHES` with the new hash of `src/etc/vscode_settings.json`"
"Update `SETTINGS_HASHES` with the new hash of `src/etc/rust_analyzer_settings.json`"
);
}
File renamed without changes.