diff options
| author | Jakub Wieczorek <jakub@jakub.cc> | 2014-06-06 00:00:29 +0200 |
|---|---|---|
| committer | Jakub Wieczorek <jakub@jakub.cc> | 2014-06-08 13:30:04 +0200 |
| commit | 0271224bdae26260ab498f47323997f9edb5879e (patch) | |
| tree | 4b2b91ede68b072dcafa37b0fb2a338b1e6b0483 /src/libsyntax | |
| parent | 7580ef902eaaf402219b47c3f92019c0644086db (diff) | |
| download | rust-0271224bdae26260ab498f47323997f9edb5879e.tar.gz rust-0271224bdae26260ab498f47323997f9edb5879e.zip | |
Add detection of dead struct fields
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 2bc24fd1eb3..e18484a68f3 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1046,6 +1046,15 @@ pub struct StructField_ { pub attrs: Vec<Attribute>, } +impl StructField_ { + pub fn ident(&self) -> Option<Ident> { + match self.kind { + NamedField(ref ident, _) => Some(ident.clone()), + UnnamedField(_) => None + } + } +} + pub type StructField = Spanned<StructField_>; #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] |
