1
Fork 0

Rollup merge of #35917 - jseyfried:remove_attr_ext_traits, r=nrc

syntax: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`
This commit is contained in:
Jeffrey Seyfried 2016-08-28 10:40:04 +00:00
commit c14ff2884d
44 changed files with 92 additions and 216 deletions

View file

@ -26,9 +26,8 @@ pub use self::Visibility::*;
use syntax::abi::Abi;
use syntax::ast;
use syntax::attr;
use syntax::attr::{AttributeMethods, AttrMetaMethods, AttrNestedMetaItemMethods};
use syntax::codemap::Spanned;
use syntax::parse::token::{self, InternedString, keywords};
use syntax::parse::token::keywords;
use syntax::ptr::P;
use syntax::print::pprust as syntax_pprust;
use syntax_pos::{self, DUMMY_SP, Pos};
@ -541,62 +540,6 @@ impl Clean<Attribute> for ast::Attribute {
}
}
// This is a rough approximation that gets us what we want.
impl attr::AttrNestedMetaItemMethods for Attribute {
fn check_name(&self, name: &str) -> bool {
self.name().map_or(false, |mi_name| &*mi_name == name)
}
fn literal(&self) -> Option<&ast::Lit> { None }
fn is_literal(&self) -> bool {
match *self {
Literal(..) => true,
_ => false,
}
}
fn meta_item(&self) -> Option<&P<ast::MetaItem>> { None }
fn name(&self) -> Option<InternedString> {
match *self {
Word(ref n) | List(ref n, _) | NameValue(ref n, _) => {
Some(token::intern_and_get_ident(n))
},
_ => None
}
}
fn value_str(&self) -> Option<InternedString> {
match *self {
NameValue(_, ref v) => {
Some(token::intern_and_get_ident(v))
}
_ => None,
}
}
fn word(&self) -> Option<&P<ast::MetaItem>> { None }
fn is_word(&self) -> bool {
match *self {
Word(_) => true,
_ => false,
}
}
fn meta_item_list<'a>(&'a self) -> Option<&'a [ast::NestedMetaItem]> { None }
fn is_meta_item_list(&self) -> bool {
match *self {
List(..) => true,
_ => false,
}
}
fn span(&self) -> syntax_pos::Span { unimplemented!() }
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)]
pub struct TyParam {
pub name: String,