From f5e06dc06d715ff62dfd0b13f692d561ed67cfd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=8A=E6=AC=A7?= Date: Thu, 21 Dec 2023 13:12:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20clippy.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/app/src/main.rs | 7 ++--- examples/web/Cargo.toml | 2 +- examples/web/src/pages/portal.rs | 4 +-- packages/components-container/Cargo.toml | 2 +- .../src/components/container_layout.rs | 29 ++++++++++--------- packages/components-form/Cargo.toml | 2 +- .../src/components/button_group.rs | 8 ++--- packages/macro-types/Cargo.toml | 2 +- packages/macro/src/utils/routes.rs | 8 +++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/app/src/main.rs b/examples/app/src/main.rs index eea059a..e240414 100644 --- a/examples/app/src/main.rs +++ b/examples/app/src/main.rs @@ -9,11 +9,8 @@ use tauri::Manager; fn my_custom_command(window: tauri::Window, app_handle: tauri::AppHandle) -> String { println!("{}", window.label()); let app_path = app_handle.path_resolver().app_data_dir(); - match app_path { - Some(dir) => { - println!("{}", dir.display()) - } - None => {} + if let Some(dir) = app_path { + println!("{}", dir.display()) }; window.set_always_on_top(true).unwrap(); // window diff --git a/examples/web/Cargo.toml b/examples/web/Cargo.toml index 7400e6f..fdfef0d 100644 --- a/examples/web/Cargo.toml +++ b/examples/web/Cargo.toml @@ -17,13 +17,13 @@ anyhow = "^1" async-trait = "^0.1" base64 = "^0.21" derive_more = "*" -gloo = "^0.11" serde = { version = "^1", features = ["derive"] } serde_json = "^1" strum = "^0.25" strum_macros = "^0.25" console_log = "^1" +gloo = "^0.11" js-sys = "^0.3" log = "^0.4" wasm-bindgen = "0.2.87" diff --git a/examples/web/src/pages/portal.rs b/examples/web/src/pages/portal.rs index d274a07..02712be 100644 --- a/examples/web/src/pages/portal.rs +++ b/examples/web/src/pages/portal.rs @@ -29,9 +29,9 @@ pub fn Portal() -> Html { let data = data.to_owned(); wasm_bindgen_futures::spawn_local(async move { - match Request::get(&*uri).send().await { + match Request::get(&uri).send().await { Ok(response) => { - let raw = (&response).text().await.unwrap(); + let raw = response.text().await.unwrap(); info!("{:?}", response); data.set(raw); } diff --git a/packages/components-container/Cargo.toml b/packages/components-container/Cargo.toml index ab03017..226963f 100644 --- a/packages/components-container/Cargo.toml +++ b/packages/components-container/Cargo.toml @@ -15,13 +15,13 @@ hikari-theme = { path = "../theme" } anyhow = "^1" base64 = "^0.21" derive_more = "*" -gloo = "^0.11" serde = { version = "^1", features = ["derive"] } serde_json = "^1" strum = "^0.25" strum_macros = "^0.25" console_log = "^1" +gloo = "^0.11" js-sys = "^0.3" log = "^0.4" wasm-bindgen = "0.2.87" diff --git a/packages/components-container/src/components/container_layout.rs b/packages/components-container/src/components/container_layout.rs index 8d50ffd..bd90ce1 100644 --- a/packages/components-container/src/components/container_layout.rs +++ b/packages/components-container/src/components/container_layout.rs @@ -5,22 +5,22 @@ use super::{AsideLayout, FooterLayout, HeaderLayout, MainLayout}; #[derive(Clone, PartialEq)] pub enum ContainerLayoutVariant { - AsideLayout(VChild), - FooterLayout(VChild), - HeaderLayout(VChild), - MainLayout(VChild), - ContainerLayout(VChild), + Aside(VChild), + Footer(VChild), + Header(VChild), + Main(VChild), + Container(VChild), } #[allow(clippy::from_over_into)] impl Into for ContainerLayoutVariant { fn into(self) -> Html { match self { - Self::AsideLayout(child) => child.into(), - Self::FooterLayout(child) => child.into(), - Self::HeaderLayout(child) => child.into(), - Self::MainLayout(child) => child.into(), - Self::ContainerLayout(child) => child.into(), + Self::Aside(child) => child.into(), + Self::Footer(child) => child.into(), + Self::Header(child) => child.into(), + Self::Main(child) => child.into(), + Self::Container(child) => child.into(), } } } @@ -33,10 +33,11 @@ pub struct ContainerLayoutProps { #[styled_component] pub fn ContainerLayout(props: &ContainerLayoutProps) -> Html { - let is_vertical = if props.children.iter().any(|child| match child { - ContainerLayoutVariant::HeaderLayout(_) => true, - ContainerLayoutVariant::FooterLayout(_) => true, - _ => false, + let is_vertical = if props.children.iter().any(|child| { + matches!( + child, + ContainerLayoutVariant::Header(_) | ContainerLayoutVariant::Footer(_) + ) }) { Some(css!("flex-direction: column;")) } else { diff --git a/packages/components-form/Cargo.toml b/packages/components-form/Cargo.toml index 5e9df44..2761f7e 100644 --- a/packages/components-form/Cargo.toml +++ b/packages/components-form/Cargo.toml @@ -16,13 +16,13 @@ hikari-theme = { path = "../theme" } anyhow = "^1" base64 = "^0.21" derive_more = "*" -gloo = "^0.11" serde = { version = "^1", features = ["derive"] } serde_json = "^1" strum = "^0.25" strum_macros = "^0.25" console_log = "^1" +gloo = "^0.11" js-sys = "^0.3" log = "^0.4" wasm-bindgen = "0.2.87" diff --git a/packages/components-form/src/components/button_group.rs b/packages/components-form/src/components/button_group.rs index 1a348bc..e175927 100644 --- a/packages/components-form/src/components/button_group.rs +++ b/packages/components-form/src/components/button_group.rs @@ -10,10 +10,10 @@ pub enum ButtonGroupVariant { Button(VChild