Skip to content

Commit

Permalink
Use absolute paths in 'FromFormValue' derive.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jebrosen authored and SergioBenitez committed Jul 25, 2018
1 parent a7cc554 commit 706cd32
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions core/codegen_next/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 706cd32

Please sign in to comment.