Use more descriptive names in dead code messages

This commit is contained in:
Jakub Wieczorek
2014-09-20 14:08:10 +02:00
parent 2ec795b4f0
commit 3530e4a647
10 changed files with 59 additions and 31 deletions

View File

@@ -1323,6 +1323,22 @@ pub enum Item_ {
ItemMac(Mac),
}
impl Item_ {
pub fn descriptive_variant(&self) -> &str {
match *self {
ItemStatic(..) => "static item",
ItemFn(..) => "function",
ItemMod(..) => "module",
ItemForeignMod(..) => "foreign module",
ItemTy(..) => "type alias",
ItemEnum(..) => "enum",
ItemStruct(..) => "struct",
ItemTrait(..) => "trait",
_ => "item"
}
}
}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct ForeignItem {
pub ident: Ident,
@@ -1339,6 +1355,15 @@ pub enum ForeignItem_ {
ForeignItemStatic(P<Ty>, /* is_mutbl */ bool),
}
impl ForeignItem_ {
pub fn descriptive_variant(&self) -> &str {
match *self {
ForeignItemFn(..) => "foreign function",
ForeignItemStatic(..) => "foreign static item"
}
}
}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum UnboxedClosureKind {
FnUnboxedClosureKind,