From b01c1e2092b0d3c4e86aedf1e0875898fbde21e3 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 23 Feb 2020 06:04:37 +0100 Subject: parser: tweak item kind wording --- src/libsyntax/ast.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index dd3319fcba1..f8a27cf7142 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2574,23 +2574,34 @@ pub enum ItemKind { } impl ItemKind { - pub fn descriptive_variant(&self) -> &str { - match *self { + pub fn article(&self) -> &str { + use ItemKind::*; + match self { + Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..) + | Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..) => "a", + ExternCrate(..) | ForeignMod(..) | Mac(..) | Enum(..) | Impl { .. } => "an", + } + } + + pub fn descr(&self) -> &str { + match self { ItemKind::ExternCrate(..) => "extern crate", - ItemKind::Use(..) => "use", + ItemKind::Use(..) => "`use` import", ItemKind::Static(..) => "static item", ItemKind::Const(..) => "constant item", ItemKind::Fn(..) => "function", ItemKind::Mod(..) => "module", - ItemKind::ForeignMod(..) => "foreign module", - ItemKind::GlobalAsm(..) => "global asm", + ItemKind::ForeignMod(..) => "extern block", + ItemKind::GlobalAsm(..) => "global asm item", ItemKind::TyAlias(..) => "type alias", ItemKind::Enum(..) => "enum", ItemKind::Struct(..) => "struct", ItemKind::Union(..) => "union", ItemKind::Trait(..) => "trait", ItemKind::TraitAlias(..) => "trait alias", - ItemKind::Mac(..) | ItemKind::MacroDef(..) | ItemKind::Impl { .. } => "item", + ItemKind::Mac(..) => "item macro invocation", + ItemKind::MacroDef(..) => "macro definition", + ItemKind::Impl { .. } => "implementation", } } -- cgit 1.4.1-3-g733a5