about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-06-08 11:40:56 +1200
committerNick Cameron <ncameron@mozilla.com>2015-06-08 11:41:48 +1200
commit83c73e327a95513256fb70d069b1cccd94fa6080 (patch)
tree4deaaf2ce13351d928eaf0a4cc9aa6e47268f720
parent79b0c89d509d673ee34097b5dcb0d609fea6619d (diff)
review changes - only show closure ids in verbose mode
-rw-r--r--src/librustc/util/ppaux.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 3eb2e9470d6..acbd09f671b 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -311,7 +311,11 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
         let mut s = String::new();
         s.push_str("[closure");
         push_sig_to_string(cx, &mut s, '(', ')', &cty.sig);
-        s.push_str(&format!(" id={:?}]", did));
+        if cx.sess.verbose() {
+            s.push_str(&format!(" id={:?}]", did));
+        } else {
+            s.push(']');
+        }
         s
     }
 
@@ -412,11 +416,18 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
             closure_tys.get(did).map(|closure_type| {
                 closure_to_string(cx, &closure_type.subst(cx, substs), did)
             }).unwrap_or_else(|| {
+                let id_str = if cx.sess.verbose() {
+                    format!(" id={:?}", did)
+                } else {
+                    "".to_owned()
+                };
+
+
                 if did.krate == ast::LOCAL_CRATE {
                     let span = cx.map.span(did.node);
-                    format!("[closure {} id={:?}]", span.repr(cx), did)
+                    format!("[closure {}{}]", span.repr(cx), id_str)
                 } else {
-                    format!("[closure id={:?}]", did)
+                    format!("[closure{}]", id_str)
                 }
             })
         }