diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7385c7e6e..32a5c2709 100755 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -190,8 +190,10 @@ unimplemented = "deny" # Development quality lints todo = "warn" dbg_macro = "warn" -#print_stdout = "warn" -#print_stderr = "warn" + +# 我们期望所有输出方式通过 logging 模块进行统一管理 +# print_stdout = "deny" +# print_stderr = "deny" # Performance lints for proxy application clone_on_ref_ptr = "warn" @@ -249,3 +251,10 @@ iter_on_empty_collections = "deny" equatable_if_let = "deny" collection_is_never_read = "deny" branches_sharing_code = "deny" +pathbuf_init_then_push = "deny" +option_as_ref_cloned = "deny" +large_types_passed_by_value = "deny" +# implicit_clone = "deny" // 可能会造成额外开销,暂时不开启 +expl_impl_clone_on_copy = "deny" +copy_iterator = "deny" +cloned_instead_of_copied = "deny" diff --git a/src-tauri/src/core/backup.rs b/src-tauri/src/core/backup.rs index 11681ab06..229139801 100644 --- a/src-tauri/src/core/backup.rs +++ b/src-tauri/src/core/backup.rs @@ -100,13 +100,12 @@ impl WebDavClient { let config = WebDavConfig { url: verge .webdav_url - .as_ref() - .cloned() + .clone() .unwrap_or_default() .trim_end_matches('/') .into(), - username: verge.webdav_username.as_ref().cloned().unwrap_or_default(), - password: verge.webdav_password.as_ref().cloned().unwrap_or_default(), + username: verge.webdav_username.clone().unwrap_or_default(), + password: verge.webdav_password.clone().unwrap_or_default(), }; // 存储配置到 ArcSwapOption diff --git a/src-tauri/src/core/hotkey.rs b/src-tauri/src/core/hotkey.rs index 6a06756c2..f2b2d0be0 100755 --- a/src-tauri/src/core/hotkey.rs +++ b/src-tauri/src/core/hotkey.rs @@ -274,7 +274,7 @@ impl Hotkey { ); // Extract hotkeys data before async operations - let hotkeys = verge.data_arc().hotkeys.as_ref().cloned(); + let hotkeys = verge.data_arc().hotkeys.clone(); if let Some(hotkeys) = hotkeys { logging!( diff --git a/src-tauri/src/utils/draft.rs b/src-tauri/src/utils/draft.rs index cc81b1f2d..8eab1f302 100644 --- a/src-tauri/src/utils/draft.rs +++ b/src-tauri/src/utils/draft.rs @@ -27,11 +27,7 @@ impl Draft { /// 这也是零拷贝:只 clone Arc,不 clone T pub fn latest_arc(&self) -> SharedBox { let guard = self.inner.read(); - guard - .1 - .as_ref() - .cloned() - .unwrap_or_else(|| Arc::clone(&guard.0)) + guard.1.clone().unwrap_or_else(|| Arc::clone(&guard.0)) } /// 通过闭包以可变方式编辑草稿(在闭包中我们给出 &mut T)