diff --git a/core/codegen_next/src/lib.rs b/core/codegen_next/src/lib.rs index 1b4a0f95e1..943a624632 100644 --- a/core/codegen_next/src/lib.rs +++ b/core/codegen_next/src/lib.rs @@ -72,24 +72,15 @@ fn real_derive_from_form_value(input: TokenStream) -> PResult { // Generate the implementation. Ok(quote! { - mod scope { - extern crate std; - extern crate rocket; + impl<'v> ::rocket::request::FromFormValue<'v> for #name { + type Error = &'v ::rocket::http::RawStr; - use self::std::prelude::v1::*; - use self::rocket::request::FromFormValue; - use self::rocket::http::RawStr; + fn from_form_value(v: &'v ::rocket::http::RawStr) -> ::std::result::Result { + #(if v.as_uncased_str() == #variant_strs { + return ::std::result::Result::Ok(#names::#variant_idents); + })* - impl<'v> FromFormValue<'v> for #name { - type Error = &'v RawStr; - - fn from_form_value(v: &'v RawStr) -> Result { - #(if v.as_uncased_str() == #variant_strs { - return Ok(#names::#variant_idents); - })* - - Err(v) - } + ::std::result::Result::Err(v) } } }.into())