diff --git a/codegen/src/parser/catch.rs b/codegen/src/parser/catch.rs index d1d57c41..d46f7f77 100644 --- a/codegen/src/parser/catch.rs +++ b/codegen/src/parser/catch.rs @@ -62,7 +62,7 @@ fn parse_code(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned { 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)) diff --git a/codegen/src/parser/route.rs b/codegen/src/parser/route.rs index a4a0f662..ce249c83 100644 --- a/codegen/src/parser/route.rs +++ b/codegen/src/parser/route.rs @@ -169,7 +169,7 @@ fn parse_method(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned { `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>, Option>) { 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); diff --git a/codegen/src/utils/meta_item_ext.rs b/codegen/src/utils/meta_item_ext.rs index 242141c5..c3bfcff5 100644 --- a/codegen/src/utils/meta_item_ext.rs +++ b/codegen/src/utils/meta_item_ext.rs @@ -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; } 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, }) }