mirror of https://github.com/rwf2/Rocket.git
Update codegen for 2018-05-03 nightly.
This commit is contained in:
parent
b876f233a8
commit
1dab03f929
|
@ -62,7 +62,7 @@ fn parse_code(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<u16> {
|
|||
|
||||
let sp = meta_item.span();
|
||||
if let Some((name, lit)) = meta_item.name_value() {
|
||||
if name != &"code" {
|
||||
if name != "code" {
|
||||
ecx.span_err(sp, "the first key, if any, must be 'code'");
|
||||
} else if let LitKind::Int(n, _) = lit.node {
|
||||
return code_from_u128(span(n, lit.span))
|
||||
|
|
|
@ -169,7 +169,7 @@ fn parse_method(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<Method> {
|
|||
`HEAD`, `PATCH`, `OPTIONS`";
|
||||
|
||||
if let Some(word) = meta_item.word() {
|
||||
if let Ok(method) = Method::from_str(&word.ident.name.as_str()) {
|
||||
if let Ok(method) = Method::from_str(&word.name().as_str()) {
|
||||
if is_valid_method(method) {
|
||||
return span(method, word.span());
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ fn parse_path(ecx: &ExtCtxt,
|
|||
-> (Spanned<Uri<'static>>, Option<Spanned<Ident>>) {
|
||||
let sp = meta_item.span();
|
||||
if let Some((name, lit)) = meta_item.name_value() {
|
||||
if name != &"path" {
|
||||
if name != "path" {
|
||||
ecx.span_err(sp, "the first key, if any, must be 'path'");
|
||||
} else if let LitKind::Str(ref s, _) = lit.node {
|
||||
return validate_uri(ecx, &s.as_str(), lit.span);
|
||||
|
|
|
@ -2,15 +2,15 @@ use syntax::ast::{LitKind, NestedMetaItem, MetaItemKind, Lit};
|
|||
use syntax::symbol::Symbol;
|
||||
|
||||
pub trait MetaItemExt {
|
||||
fn name_value(&self) -> Option<(&Symbol, &Lit)>;
|
||||
fn name_value(&self) -> Option<(Symbol, &Lit)>;
|
||||
fn str_lit(&self) -> Option<&Symbol>;
|
||||
fn int_lit(&self) -> Option<u128>;
|
||||
}
|
||||
|
||||
impl MetaItemExt for NestedMetaItem {
|
||||
fn name_value(&self) -> Option<(&Symbol, &Lit)> {
|
||||
fn name_value(&self) -> Option<(Symbol, &Lit)> {
|
||||
self.meta_item().and_then(|mi| match mi.node {
|
||||
MetaItemKind::NameValue(ref l) => Some((&mi.ident.name, l)),
|
||||
MetaItemKind::NameValue(ref l) => Some((mi.name(), l)),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue