diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-25 15:41:17 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-25 15:41:17 +0800 |
| commit | 2865206dda1d57df1c95dd8e49d5599db89407ae (patch) | |
| tree | 1e6e2198dacc7cd5f56335b20268856af8bf8a70 /crates/vcs/src/workspace/vault.rs | |
| parent | 17233e0c83c1b25a32c641eb32eb1fba3061cdfd (diff) | |
Fix clippy warnings and optimize code
- Rename from_str to from_address_str in tcp_connection to avoid trait conflict
- Use ? operator instead of let...else patterns in local and vault initialization
- Replace manual string slicing with strip_prefix in virtual_file.rs
- All tests continue to pass after optimizations
Diffstat (limited to 'crates/vcs/src/workspace/vault.rs')
| -rw-r--r-- | crates/vcs/src/workspace/vault.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/vcs/src/workspace/vault.rs b/crates/vcs/src/workspace/vault.rs index 912c6e2..7f52c9c 100644 --- a/crates/vcs/src/workspace/vault.rs +++ b/crates/vcs/src/workspace/vault.rs @@ -34,17 +34,13 @@ impl Vault { /// Initialize vault pub fn init(config: VaultConfig, vault_path: impl Into<PathBuf>) -> Option<Self> { - let Some(vault_path) = find_vault_path(vault_path) else { - return None; - }; + let vault_path = find_vault_path(vault_path)?; Some(Self { config, vault_path }) } /// Initialize vault pub fn init_current_dir(config: VaultConfig) -> Option<Self> { - let Some(vault_path) = current_vault_path() else { - return None; - }; + let vault_path = current_vault_path()?; Some(Self { config, vault_path }) } |
