From 706cd320539c79aea0f7c8b51726dad088fcf7f4 Mon Sep 17 00:00:00 2001 From: jeb Date: Fri, 13 Jul 2018 16:45:48 -0600 Subject: [PATCH] Use absolute paths in 'FromFormValue' derive. This resolves a warning introduced in rust-lang/rust#51952 that will eventually become a hard error, the latter of which is being tracked in rust-lang/rust#50504. --- core/codegen_next/src/lib.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) 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())