diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-21 15:02:50 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-21 15:03:55 +0800 |
| commit | 4704f6d54108bcc8f9b2fb7f4b3c4e224b4a7809 (patch) | |
| tree | 425b15395de24717f9732d8642e75044774d4583 /mingling_macros/src/completion.rs | |
| parent | a9755711b490529c26bdb4b024c6caf825940dd3 (diff) | |
Remove `once_cell` dependency and replace with `OnceLock`
Diffstat (limited to 'mingling_macros/src/completion.rs')
| -rw-r--r-- | mingling_macros/src/completion.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mingling_macros/src/completion.rs b/mingling_macros/src/completion.rs index cd4a9ad..ba0de2e 100644 --- a/mingling_macros/src/completion.rs +++ b/mingling_macros/src/completion.rs @@ -6,6 +6,8 @@ use syn::{FnArg, Ident, ItemFn, PatType, Type, parse_macro_input}; #[cfg(feature = "comp")] pub fn completion_attr(attr: TokenStream, item: TokenStream) -> TokenStream { // Parse the attribute arguments (e.g., HelloEntry from #[completion(HelloEntry)]) + + use crate::get_global_set; let previous_type_ident = if attr.is_empty() { return syn::Error::new( proc_macro2::Span::call_site(), @@ -109,7 +111,7 @@ pub fn completion_attr(attr: TokenStream, item: TokenStream) -> TokenStream { Self::#previous_type_ident => <#struct_name as ::mingling::Completion>::comp(ctx), }; - let mut completions = crate::COMPLETIONS.lock().unwrap(); + let mut completions = get_global_set(&crate::COMPLETIONS).lock().unwrap(); let completion_str = completion_entry.to_string(); completions.insert(completion_str); |
