mirror of https://github.com/rwf2/Rocket.git
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.
This commit is contained in:
parent
a7cc5542ab
commit
706cd32053
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue