From 2865206dda1d57df1c95dd8e49d5599db89407ae Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 25 Sep 2025 15:41:17 +0800 Subject: 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 --- crates/vcs/src/workspace/vault.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/vcs/src/workspace/vault.rs') 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) -> Option { - 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 { - let Some(vault_path) = current_vault_path() else { - return None; - }; + let vault_path = current_vault_path()?; Some(Self { config, vault_path }) } -- cgit