style: format Rust rename updates
This commit is contained in:
@@ -101,7 +101,10 @@ fn run_git(dir: &Path, args: &[&str]) -> Result<(), String> {
|
||||
|
||||
/// Set local user.name and user.email if not already configured.
|
||||
fn ensure_author_config(dir: &Path) -> Result<(), String> {
|
||||
for (key, fallback) in [("user.name", "Tolaria"), ("user.email", "vault@tolaria.app")] {
|
||||
for (key, fallback) in [
|
||||
("user.name", "Tolaria"),
|
||||
("user.email", "vault@tolaria.app"),
|
||||
] {
|
||||
let check = Command::new("git")
|
||||
.args(["config", key])
|
||||
.current_dir(dir)
|
||||
|
||||
@@ -53,7 +53,11 @@ fn fallback_node_path() -> Option<PathBuf> {
|
||||
.collect::<Vec<_>>();
|
||||
versions.sort();
|
||||
versions.reverse();
|
||||
candidates.extend(versions.into_iter().map(|version| version.join("bin").join("node")));
|
||||
candidates.extend(
|
||||
versions
|
||||
.into_iter()
|
||||
.map(|version| version.join("bin").join("node")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +275,10 @@ mod tests {
|
||||
|
||||
let raw = std::fs::read_to_string(&config_path).unwrap();
|
||||
let config: serde_json::Value = serde_json::from_str(&raw).unwrap();
|
||||
assert_eq!(config["mcpServers"][MCP_SERVER_NAME]["args"][0], "/test/index.js");
|
||||
assert_eq!(
|
||||
config["mcpServers"][MCP_SERVER_NAME]["args"][0],
|
||||
"/test/index.js"
|
||||
);
|
||||
assert_eq!(
|
||||
config["mcpServers"][MCP_SERVER_NAME]["env"]["VAULT_PATH"],
|
||||
"/test/vault"
|
||||
@@ -321,7 +328,10 @@ mod tests {
|
||||
let raw = std::fs::read_to_string(&config_path).unwrap();
|
||||
let config: serde_json::Value = serde_json::from_str(&raw).unwrap();
|
||||
assert!(config["mcpServers"][LEGACY_MCP_SERVER_NAME].is_null());
|
||||
assert_eq!(config["mcpServers"][MCP_SERVER_NAME]["args"][0], "/test/index.js");
|
||||
assert_eq!(
|
||||
config["mcpServers"][MCP_SERVER_NAME]["args"][0],
|
||||
"/test/index.js"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -424,7 +434,10 @@ mod tests {
|
||||
|
||||
let raw = std::fs::read_to_string(&claude_cfg).unwrap();
|
||||
let config: serde_json::Value = serde_json::from_str(&raw).unwrap();
|
||||
assert_eq!(config["mcpServers"][MCP_SERVER_NAME]["args"][0], "/test/index.js");
|
||||
assert_eq!(
|
||||
config["mcpServers"][MCP_SERVER_NAME]["args"][0],
|
||||
"/test/index.js"
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn upsert_returns_error_for_invalid_json() {
|
||||
|
||||
@@ -18,8 +18,7 @@ pub struct Settings {
|
||||
}
|
||||
|
||||
fn app_config_dir() -> Result<PathBuf, String> {
|
||||
dirs::config_dir()
|
||||
.ok_or_else(|| "Could not determine config directory".to_string())
|
||||
dirs::config_dir().ok_or_else(|| "Could not determine config directory".to_string())
|
||||
}
|
||||
|
||||
fn preferred_app_config_path(file_name: &str) -> Result<PathBuf, String> {
|
||||
@@ -32,7 +31,9 @@ fn resolve_existing_or_preferred_app_config_path(file_name: &str) -> Result<Path
|
||||
return Ok(preferred);
|
||||
}
|
||||
|
||||
let legacy = app_config_dir()?.join(LEGACY_APP_CONFIG_DIR).join(file_name);
|
||||
let legacy = app_config_dir()?
|
||||
.join(LEGACY_APP_CONFIG_DIR)
|
||||
.join(file_name);
|
||||
if legacy.exists() {
|
||||
return Ok(legacy);
|
||||
}
|
||||
@@ -282,7 +283,11 @@ mod tests {
|
||||
fn test_preferred_settings_path_uses_tolaria_namespace() {
|
||||
let result = preferred_app_config_path("settings.json");
|
||||
assert!(result.is_ok());
|
||||
assert!(result.unwrap().to_str().unwrap().contains("com.tolaria.app"));
|
||||
assert!(result
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.contains("com.tolaria.app"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -20,8 +20,7 @@ pub struct VaultList {
|
||||
}
|
||||
|
||||
fn app_config_dir() -> Result<PathBuf, String> {
|
||||
dirs::config_dir()
|
||||
.ok_or_else(|| "Could not determine config directory".to_string())
|
||||
dirs::config_dir().ok_or_else(|| "Could not determine config directory".to_string())
|
||||
}
|
||||
|
||||
fn preferred_app_config_path(file_name: &str) -> Result<PathBuf, String> {
|
||||
@@ -34,7 +33,9 @@ fn resolve_existing_or_preferred_app_config_path(file_name: &str) -> Result<Path
|
||||
return Ok(preferred);
|
||||
}
|
||||
|
||||
let legacy = app_config_dir()?.join(LEGACY_APP_CONFIG_DIR).join(file_name);
|
||||
let legacy = app_config_dir()?
|
||||
.join(LEGACY_APP_CONFIG_DIR)
|
||||
.join(file_name);
|
||||
if legacy.exists() {
|
||||
return Ok(legacy);
|
||||
}
|
||||
@@ -164,7 +165,11 @@ mod tests {
|
||||
fn preferred_vault_list_path_uses_tolaria_namespace() {
|
||||
let result = preferred_app_config_path("vaults.json");
|
||||
assert!(result.is_ok());
|
||||
assert!(result.unwrap().to_str().unwrap().contains("com.tolaria.app"));
|
||||
assert!(result
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.contains("com.tolaria.app"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user