Skip to content

Commit 706cd32

Browse files
jebrosenSergioBenitez
authored andcommitted
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.
1 parent a7cc554 commit 706cd32

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

core/codegen_next/src/lib.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,15 @@ fn real_derive_from_form_value(input: TokenStream) -> PResult<TokenStream> {
7272

7373
// Generate the implementation.
7474
Ok(quote! {
75-
mod scope {
76-
extern crate std;
77-
extern crate rocket;
75+
impl<'v> ::rocket::request::FromFormValue<'v> for #name {
76+
type Error = &'v ::rocket::http::RawStr;
7877

79-
use self::std::prelude::v1::*;
80-
use self::rocket::request::FromFormValue;
81-
use self::rocket::http::RawStr;
78+
fn from_form_value(v: &'v ::rocket::http::RawStr) -> ::std::result::Result<Self, Self::Error> {
79+
#(if v.as_uncased_str() == #variant_strs {
80+
return ::std::result::Result::Ok(#names::#variant_idents);
81+
})*
8282

83-
impl<'v> FromFormValue<'v> for #name {
84-
type Error = &'v RawStr;
85-
86-
fn from_form_value(v: &'v RawStr) -> Result<Self, Self::Error> {
87-
#(if v.as_uncased_str() == #variant_strs {
88-
return Ok(#names::#variant_idents);
89-
})*
90-
91-
Err(v)
92-
}
83+
::std::result::Result::Err(v)
9384
}
9485
}
9586
}.into())

0 commit comments

Comments
 (0)