style: cargo clippy & cargo fmt

This commit is contained in:
pan93412
2022-11-26 17:10:25 +08:00
parent 54c188f347
commit e59d25bea7

View File

@@ -37,7 +37,7 @@ use wry::{
menu::MenuType, menu::MenuType,
window::{Fullscreen, Window, WindowBuilder}, window::{Fullscreen, Window, WindowBuilder},
}, },
webview::{WebViewBuilder, WebContext}, webview::{WebContext, WebViewBuilder},
}; };
fn main() -> wry::Result<()> { fn main() -> wry::Result<()> {
@@ -129,9 +129,7 @@ fn main() -> wry::Result<()> {
.unwrap(); .unwrap();
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let window = common_window let window = common_window.build(&event_loop).unwrap();
.build(&event_loop)
.unwrap();
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let window = common_window let window = common_window
@@ -163,7 +161,7 @@ fn main() -> wry::Result<()> {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let webview = WebViewBuilder::new(window)? let webview = WebViewBuilder::new(window)?
.with_user_agent(&user_agent_string) .with_user_agent(user_agent_string)
.with_accept_first_mouse(true) .with_accept_first_mouse(true)
.with_url(&url.to_string())? .with_url(&url.to_string())?
.with_devtools(cfg!(feature = "devtools")) .with_devtools(cfg!(feature = "devtools"))
@@ -174,7 +172,7 @@ fn main() -> wry::Result<()> {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let webview = WebViewBuilder::new(window)? let webview = WebViewBuilder::new(window)?
.with_user_agent(&user_agent_string) .with_user_agent(user_agent_string)
.with_accept_first_mouse(true) .with_accept_first_mouse(true)
.with_url(&url.to_string())? .with_url(&url.to_string())?
.with_devtools(cfg!(feature = "devtools")) .with_devtools(cfg!(feature = "devtools"))
@@ -185,9 +183,8 @@ fn main() -> wry::Result<()> {
// 自定义cookie文件夹仅用于Linux // 自定义cookie文件夹仅用于Linux
// Custom Cookie folder, only for Linux // Custom Cookie folder, only for Linux
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let data_path = std::path::PathBuf::from( let data_path =
concat!("/home/", env!("USER"), "/.config/com-tw93-weread/") std::path::PathBuf::from(concat!("/home/", env!("USER"), "/.config/com-tw93-weread/"));
);
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
if !std::path::Path::new(&data_path).exists() { if !std::path::Path::new(&data_path).exists() {
std::fs::create_dir(&data_path)?; std::fs::create_dir(&data_path)?;
@@ -196,7 +193,7 @@ fn main() -> wry::Result<()> {
let mut web_content = WebContext::new(Some(data_path)); let mut web_content = WebContext::new(Some(data_path));
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let webview = WebViewBuilder::new(window)? let webview = WebViewBuilder::new(window)?
.with_user_agent(&user_agent_string) .with_user_agent(user_agent_string)
.with_accept_first_mouse(true) .with_accept_first_mouse(true)
.with_url(&url.to_string())? .with_url(&url.to_string())?
.with_devtools(cfg!(feature = "devtools")) .with_devtools(cfg!(feature = "devtools"))