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

This commit is contained in:
KittyBorgX 2023-03-01 22:58:05 +05:30
parent 5423745db8
commit a90e7d4658
3 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,7 @@ pub enum Profile {
None, 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 /// New entries should be appended whenever this is updated so we can detect
/// outdated vs. user-modified settings files. /// outdated vs. user-modified settings files.
static SETTINGS_HASHES: &[&str] = &[ static SETTINGS_HASHES: &[&str] = &[
@ -32,7 +32,7 @@ static SETTINGS_HASHES: &[&str] = &[
"56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922", "56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922",
"af1b5efe196aed007577899db9dae15d6dbc923d6fa42fa0934e68617ba9bbe0", "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 { impl Profile {
fn include_path(&self, src_path: &Path) -> PathBuf { fn include_path(&self, src_path: &Path) -> PathBuf {
@ -489,7 +489,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
Ok(()) 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)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct Vscode; pub struct Vscode;
@ -580,10 +580,10 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
} }
_ => "Created", _ => "Created",
}; };
fs::write(&vscode_settings, &VSCODE_SETTINGS)?; fs::write(&vscode_settings, &RUST_ANALYZER_SETTINGS)?;
println!("{verb} `.vscode/settings.json`"); println!("{verb} `.vscode/settings.json`");
} else { } else {
println!("\n{VSCODE_SETTINGS}"); println!("\n{RUST_ANALYZER_SETTINGS}");
} }
Ok(()) Ok(())
} }

View File

@ -1,14 +1,14 @@
use super::{SETTINGS_HASHES, VSCODE_SETTINGS}; use super::{RUST_ANALYZER_SETTINGS, SETTINGS_HASHES};
use sha2::Digest; use sha2::Digest;
#[test] #[test]
fn check_matching_settings_hash() { fn check_matching_settings_hash() {
let mut hasher = sha2::Sha256::new(); let mut hasher = sha2::Sha256::new();
hasher.update(&VSCODE_SETTINGS); hasher.update(&RUST_ANALYZER_SETTINGS);
let hash = hex::encode(hasher.finalize().as_slice()); let hash = hex::encode(hasher.finalize().as_slice());
assert_eq!( assert_eq!(
&hash, &hash,
SETTINGS_HASHES.last().unwrap(), 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`"
); );
} }