Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use core::result instead of std::result in order to make it work in a… #189

Merged
merged 1 commit into from Oct 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions strum_macros/src/macros/strings/from_string.rs
Expand Up @@ -19,7 +19,7 @@ pub fn from_string_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {

let mut default_kw = None;
let mut default =
quote! { _ => ::std::result::Result::Err(#strum_module_path::ParseError::VariantNotFound) };
quote! { _ => ::core::result::Result::Err(#strum_module_path::ParseError::VariantNotFound) };
let mut arms = Vec::new();
for variant in variants {
let ident = &variant.ident;
Expand All @@ -46,7 +46,7 @@ pub fn from_string_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {

default_kw = Some(kw);
default = quote! {
default => ::std::result::Result::Ok(#name::#ident(default.into()))
default => ::core::result::Result::Ok(#name::#ident(default.into()))
};
continue;
}
Expand Down Expand Up @@ -82,16 +82,16 @@ pub fn from_string_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
}
};

arms.push(quote! { #(#attrs => ::std::result::Result::Ok(#name::#ident #params)),* });
arms.push(quote! { #(#attrs => ::core::result::Result::Ok(#name::#ident #params)),* });
}

arms.push(default);

Ok(quote! {
#[allow(clippy::use_self)]
impl #impl_generics ::std::str::FromStr for #name #ty_generics #where_clause {
impl #impl_generics ::core::str::FromStr for #name #ty_generics #where_clause {
type Err = #strum_module_path::ParseError;
fn from_str(s: &str) -> ::std::result::Result< #name #ty_generics , Self::Err> {
fn from_str(s: &str) -> ::core::result::Result< #name #ty_generics , Self::Err> {
match s {
#(#arms),*
}
Expand Down