mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
refactor: update linting rules and optimize directory handling in Unix
This commit is contained in:
@@ -239,3 +239,6 @@ redundant_clone = "deny"
|
|||||||
needless_pass_by_ref_mut = "deny"
|
needless_pass_by_ref_mut = "deny"
|
||||||
needless_collect = "deny"
|
needless_collect = "deny"
|
||||||
missing_const_for_fn = "deny"
|
missing_const_for_fn = "deny"
|
||||||
|
iter_with_drain = "deny"
|
||||||
|
iter_on_single_items = "deny"
|
||||||
|
iter_on_empty_collections = "deny"
|
||||||
@@ -6,6 +6,8 @@ use crate::{
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
|
#[cfg(unix)]
|
||||||
|
use std::iter;
|
||||||
use std::{fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
|
|
||||||
@@ -226,8 +228,7 @@ pub fn get_encryption_key() -> Result<Vec<u8>> {
|
|||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub fn ensure_mihomo_safe_dir() -> Option<PathBuf> {
|
pub fn ensure_mihomo_safe_dir() -> Option<PathBuf> {
|
||||||
["/tmp"]
|
iter::once("/tmp")
|
||||||
.iter()
|
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.find(|path| path.exists())
|
.find(|path| path.exists())
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
|
|||||||
Reference in New Issue
Block a user