diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-08-23 03:39:04 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-08-25 20:41:39 +0000 |
| commit | e264828b27b30980f6a9c316e17dc44e6b9be09f (patch) | |
| tree | 5103b9790bd9579024135778574ca9d3cc7ba3fd /src/libsyntax | |
| parent | 4eb08bb2ab43f0ad80071469771381a4dd03603d (diff) | |
| download | rust-e264828b27b30980f6a9c316e17dc44e6b9be09f.tar.gz rust-e264828b27b30980f6a9c316e17dc44e6b9be09f.zip | |
Refactor away `AttributeMethods`.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/attr.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index f1a820ce1d4..f8fecd5fda0 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -267,23 +267,16 @@ impl AttrMetaMethods for P<MetaItem> { fn span(&self) -> Span { (**self).span() } } - -pub trait AttributeMethods { - fn meta(&self) -> &MetaItem; - fn with_desugared_doc<T, F>(&self, f: F) -> T where - F: FnOnce(&Attribute) -> T; -} - -impl AttributeMethods for Attribute { +impl Attribute { /// Extract the MetaItem from inside this Attribute. - fn meta(&self) -> &MetaItem { + pub fn meta(&self) -> &MetaItem { &self.node.value } /// Convert self to a normal #[doc="foo"] comment, if it is a /// comment like `///` or `/** */`. (Returns self unchanged for /// non-sugared doc attributes.) - fn with_desugared_doc<T, F>(&self, f: F) -> T where + pub fn with_desugared_doc<T, F>(&self, f: F) -> T where F: FnOnce(&Attribute) -> T, { if self.node.is_sugared_doc { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 562cc896aef..0caf9ae0d78 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -16,7 +16,7 @@ use ast::{SelfKind, RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; use ast::Attribute; use util::parser::AssocOp; use attr; -use attr::{AttrMetaMethods, AttributeMethods}; +use attr::AttrMetaMethods; use codemap::{self, CodeMap}; use syntax_pos::{self, BytePos}; use errors; |
