diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-14 13:12:27 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-14 13:12:27 +0800 |
| commit | 0ad594277e61e9fb41b2e470c34cff7534d6c780 (patch) | |
| tree | 3d14c3ad518c273105c89e5c3f39e38f4cfa45c2 /crates/utils/cfg_file/cfg_file_derive | |
| parent | b8844ab55a6d622370be8ce41387ff9d9897302e (diff) | |
Fixed codes by Zed
Diffstat (limited to 'crates/utils/cfg_file/cfg_file_derive')
| -rw-r--r-- | crates/utils/cfg_file/cfg_file_derive/src/lib.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/utils/cfg_file/cfg_file_derive/src/lib.rs b/crates/utils/cfg_file/cfg_file_derive/src/lib.rs index c43fd59..66a6d6f 100644 --- a/crates/utils/cfg_file/cfg_file_derive/src/lib.rs +++ b/crates/utils/cfg_file/cfg_file_derive/src/lib.rs @@ -3,11 +3,7 @@ extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; use syn::parse::ParseStream; -use syn::{ - parse_macro_input, - DeriveInput, - Attribute -}; +use syn::{Attribute, DeriveInput, parse_macro_input}; #[proc_macro_derive(ConfigFile, attributes(cfg_file))] pub fn derive_config_file(input: TokenStream) -> TokenStream { @@ -55,9 +51,13 @@ fn find_cfg_file_path(attrs: &[Attribute]) -> Option<String> { let parser = |meta: ParseStream| { let path_meta: syn::MetaNameValue = meta.parse()?; if path_meta.path.is_ident("path") - && let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. }) = path_meta.value { - return Ok(lit.value()); - } + && let syn::Expr::Lit(syn::ExprLit { + lit: syn::Lit::Str(lit), + .. + }) = path_meta.value + { + return Ok(lit.value()); + } Err(meta.error("expected `path = \"...\"`")) }; @@ -82,4 +82,4 @@ fn to_snake_case(s: &str) -> String { } } snake -}
\ No newline at end of file +} |
