about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-09-24 20:35:52 +0000
committerbors <bors@rust-lang.org>2014-09-24 20:35:52 +0000
commit4d69696ff62fb9f069fd8f64eaa0defe4c8c9cf7 (patch)
tree9666241bbfdde746072428a34f021e94b6ed1713 /src/libsyntax
parente0bd16c5ec7ff4c5445fa3991bd679b4d7d4e966 (diff)
parentfd52224e78fe14828f8750fed469cc5c40f260e7 (diff)
downloadrust-4d69696ff62fb9f069fd8f64eaa0defe4c8c9cf7.tar.gz
rust-4d69696ff62fb9f069fd8f64eaa0defe4c8c9cf7.zip
auto merge of #17410 : jakub-/rust/dead-code, r=alexcrichton
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs25
-rw-r--r--src/libsyntax/ext/format.rs9
2 files changed, 26 insertions, 8 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 74c69762be1..38d8136c1a1 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -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,
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index b760c893a10..1ed41e6870d 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -24,8 +24,7 @@ use std::string;
 #[deriving(PartialEq)]
 enum ArgumentType {
     Known(string::String),
-    Unsigned,
-    String,
+    Unsigned
 }
 
 enum Position {
@@ -691,12 +690,6 @@ impl<'a, 'b> Context<'a, 'b> {
                     }
                 }
             }
-            String => {
-                return ecx.expr_call_global(sp, vec![
-                        ecx.ident_of("std"),
-                        ecx.ident_of("fmt"),
-                        ecx.ident_of("argumentstr")], vec![arg])
-            }
             Unsigned => {
                 return ecx.expr_call_global(sp, vec![
                         ecx.ident_of("std"),