mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 02:12:10 +08:00
chore(rust): upgrade to 1.100 and consolidate Clippy rules (#8636)
This commit is contained in:
@@ -3,10 +3,10 @@ use crate::{config::with_encryption, process::AsyncHandler};
|
||||
use anyhow::{Context as _, Result, anyhow, bail};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use nanoid::nanoid;
|
||||
use scopeguard::{ScopeGuard, guard};
|
||||
use serde::{Serialize, de::DeserializeOwned};
|
||||
use serde_yaml_ng::{Mapping, Value};
|
||||
use std::{
|
||||
mem::DropGuard,
|
||||
path::{Path, PathBuf},
|
||||
str::FromStr,
|
||||
};
|
||||
@@ -168,7 +168,7 @@ pub async fn save_yaml_str(path: &Path, yaml_str: &str) -> Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let temporary = guard(temporary, |path| {
|
||||
let temporary = DropGuard::new(temporary, |path| {
|
||||
let _ = std::fs::remove_file(path);
|
||||
});
|
||||
let mut file = tokio::fs::File::from_std(file);
|
||||
@@ -195,7 +195,7 @@ pub async fn save_yaml_str(path: &Path, yaml_str: &str) -> Result<()> {
|
||||
|
||||
std::fs::rename(temporary.as_path(), path)
|
||||
.with_context(|| format!("failed to replace file \"{}\"", path.display()))?;
|
||||
let _ = ScopeGuard::into_inner(temporary);
|
||||
let _ = DropGuard::dismiss(temporary);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -234,15 +234,15 @@ impl WindowManager {
|
||||
}
|
||||
|
||||
pub fn is_main_window_visible(window: Option<&WebviewWindow<Wry>>) -> bool {
|
||||
window.map(|w| w.is_visible().unwrap_or(false)).unwrap_or(false)
|
||||
window.is_some_and(|w| w.is_visible().unwrap_or(false))
|
||||
}
|
||||
|
||||
pub fn is_main_window_focused(window: Option<&WebviewWindow<Wry>>) -> bool {
|
||||
window.map(|w| w.is_focused().unwrap_or(false)).unwrap_or(false)
|
||||
window.is_some_and(|w| w.is_focused().unwrap_or(false))
|
||||
}
|
||||
|
||||
fn is_main_window_minimized(window: Option<&WebviewWindow<Wry>>) -> bool {
|
||||
window.map(|w| w.is_minimized().unwrap_or(false)).unwrap_or(false)
|
||||
window.is_some_and(|w| w.is_minimized().unwrap_or(false))
|
||||
}
|
||||
|
||||
/// Keep new windows hidden until the frontend overlay renders, avoiding a theme flash.
|
||||
|
||||
Reference in New Issue
Block a user