Skip to content

Commit e14da6c

Browse files
authored
[fix] Use ::core::option::Option and ::core::result::Result for the macros (#97)
1 parent 872984a commit e14da6c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

anyrun-macros/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ pub fn handler(_attr: TokenStream, item: TokenStream) -> TokenStream {
1616

1717
let data = if function.sig.inputs.len() == 2 {
1818
if match function.sig.inputs.last() {
19-
Some(syn::FnArg::Typed(pat)) => match &*pat.ty {
19+
::core::option::Option::Some(syn::FnArg::Typed(pat)) => match &*pat.ty {
2020
Type::Reference(reference) => {
2121
reference.mutability.is_some()
2222
}
2323
_ => return quote! { compile_error!("Last argument must be either a reference to the shared data or should not be present at all.") }.into(),
2424
},
25-
Some(_) => return quote! { compile_error!("`self` argument, really?") }.into(),
26-
None => unreachable!(),
25+
::core::option::Option::Some(_) => return quote! { compile_error!("`self` argument, really?") }.into(),
26+
::core::option::Option::None => unreachable!(),
2727
} {
2828
quote! {
2929
ANYRUN_INTERNAL_DATA.write().unwrap().as_mut().unwrap(),
@@ -67,14 +67,14 @@ pub fn get_matches(_attr: TokenStream, item: TokenStream) -> TokenStream {
6767

6868
let fn_call = if function.sig.inputs.len() == 2 {
6969
let data = if match function.sig.inputs.last() {
70-
Some(syn::FnArg::Typed(pat)) => match &*pat.ty {
70+
::core::option::Option::Some(syn::FnArg::Typed(pat)) => match &*pat.ty {
7171
Type::Reference(reference) => {
7272
reference.mutability.is_some()
7373
}
7474
_ => return quote! { compile_error!("Last argument must be either a reference to the shared data or should not be present at all.") }.into(),
7575
},
76-
Some(_) => return quote! { compile_error!("`self` argument, really?") }.into(),
77-
None => unreachable!(),
76+
::core::option::Option::Some(_) => return quote! { compile_error!("`self` argument, really?") }.into(),
77+
::core::option::Option::None => unreachable!(),
7878
} {
7979
quote! {
8080
ANYRUN_INTERNAL_DATA.write().unwrap().as_mut()
@@ -85,7 +85,7 @@ pub fn get_matches(_attr: TokenStream, item: TokenStream) -> TokenStream {
8585
}
8686
};
8787
quote! {
88-
if let Some(data) = #data {
88+
if let ::core::option::Option::Some(data) = #data {
8989
#fn_name(input, data)
9090
} else {
9191
::abi_stable::std_types::RVec::new()
@@ -111,7 +111,7 @@ pub fn get_matches(_attr: TokenStream, item: TokenStream) -> TokenStream {
111111
#fn_call
112112
});
113113

114-
*ANYRUN_INTERNAL_THREAD.lock().unwrap() = Some((handle, current_id));
114+
*ANYRUN_INTERNAL_THREAD.lock().unwrap() = ::core::option::Option::Some((handle, current_id));
115115

116116
current_id
117117
}
@@ -177,8 +177,8 @@ pub fn init(_attr: TokenStream, item: TokenStream) -> TokenStream {
177177
#[::abi_stable::sabi_extern_fn]
178178
fn anyrun_internal_poll_matches(id: u64) -> ::anyrun_plugin::anyrun_interface::PollResult {
179179
match ANYRUN_INTERNAL_THREAD.try_lock() {
180-
Ok(thread) => match thread.as_ref() {
181-
Some((thread, task_id)) => {
180+
::core::result::Result::Ok(thread) => match thread.as_ref() {
181+
::core::option::Option::Some((thread, task_id)) => {
182182
if *task_id == id {
183183
if !thread.is_finished() {
184184
return ::anyrun_plugin::anyrun_interface::PollResult::Pending;
@@ -187,9 +187,9 @@ pub fn init(_attr: TokenStream, item: TokenStream) -> TokenStream {
187187
return ::anyrun_plugin::anyrun_interface::PollResult::Cancelled;
188188
}
189189
}
190-
None => return ::anyrun_plugin::anyrun_interface::PollResult::Cancelled,
190+
::core::option::Option::None => return ::anyrun_plugin::anyrun_interface::PollResult::Cancelled,
191191
},
192-
Err(_) => return ::anyrun_plugin::anyrun_interface::PollResult::Pending,
192+
::core::result::Result::Err(_) => return ::anyrun_plugin::anyrun_interface::PollResult::Pending,
193193
}
194194

195195
let (thread, _) = ANYRUN_INTERNAL_THREAD.lock().unwrap().take().unwrap();
@@ -202,7 +202,7 @@ pub fn init(_attr: TokenStream, item: TokenStream) -> TokenStream {
202202

203203
::std::thread::spawn(|| {
204204
let mut lock = ANYRUN_INTERNAL_DATA.write().unwrap();
205-
*lock = Some(#fn_name(config_dir));
205+
*lock = ::core::option::Option::Some(#fn_name(config_dir));
206206
});
207207
}
208208
}
@@ -231,7 +231,7 @@ pub fn config_args(_attr: TokenStream, item: TokenStream) -> TokenStream {
231231

232232
operations = quote! {
233233
#operations
234-
if let Some(val) = opt.#ident {
234+
if let ::core::option::Option::Some(val) = opt.#ident {
235235
self.#ident = val;
236236
}
237237
}

0 commit comments

Comments
 (0)