Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 706cd320539c79aea0f7c8b51726dad088fcf7f4
parent a7cc5542abde386ede2226df388f0af8493f3555
Author: jeb <jeb@jebrosen.com>
Date:   Fri, 13 Jul 2018 16:45:48 -0600

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.

Diffstat:
Mcore/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 @@ -72,24 +72,15 @@ fn real_derive_from_form_value(input: TokenStream) -> PResult<TokenStream> { // 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<Self, Self::Error> { + #(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<Self, Self::Error> { - #(if v.as_uncased_str() == #variant_strs { - return Ok(#names::#variant_idents); - })* - - Err(v) - } + ::std::result::Result::Err(v) } } }.into())