From af7daa0daff91f8a58708f2d98f94d49acc28c6a Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Wed, 17 Jun 2015 09:53:07 +0300 Subject: [PATCH] rustc: remove some unused UserString and Repr impls. --- src/librustc/util/ppaux.rs | 27 +-------------------------- src/librustc_trans/trans/meth.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 079741b0f281..7b82b49dadb1 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -45,7 +45,7 @@ pub trait Repr { } /// Produces a string suitable for showing to the user. -pub trait UserString: Repr { +pub trait UserString { fn user_string(&self) -> String; } @@ -296,14 +296,6 @@ impl<'a, T: ?Sized +UserString> UserString for &'a T { } } -impl UserString for Vec { - fn user_string(&self) -> String { - let strs: Vec = - self.iter().map(|t| t.user_string()).collect(); - strs.connect(", ") - } -} - impl Repr for def::Def { fn repr(&self) -> String { format!("{:?}", *self) @@ -475,17 +467,6 @@ impl<'tcx> Repr for ty::TraitDef<'tcx> { } } -impl Repr for ast::TraitItem { - fn repr(&self) -> String { - let kind = match self.node { - ast::ConstTraitItem(..) => "ConstTraitItem", - ast::MethodTraitItem(..) => "MethodTraitItem", - ast::TypeTraitItem(..) => "TypeTraitItem", - }; - format!("{}({}, id={})", kind, self.ident, self.id) - } -} - impl Repr for ast::Expr { fn repr(&self) -> String { format!("expr({}: {})", self.id, pprust::expr_to_string(self)) @@ -794,12 +775,6 @@ impl UserString for ast::Name { } } -impl Repr for ast::Ident { - fn repr(&self) -> String { - token::get_ident(*self).to_string() - } -} - impl Repr for ast::ExplicitSelf_ { fn repr(&self) -> String { format!("{:?}", *self) diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs index 7229995048aa..ec95bfe483c2 100644 --- a/src/librustc_trans/trans/meth.rs +++ b/src/librustc_trans/trans/meth.rs @@ -62,7 +62,7 @@ pub fn trans_impl(ccx: &CrateContext, let _icx = push_ctxt("meth::trans_impl"); let tcx = ccx.tcx(); - debug!("trans_impl(name={}, id={})", name.repr(), id); + debug!("trans_impl(name={}, id={})", name, id); let mut v = TransItemVisitor { ccx: ccx }; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index ff7c8e69a6b4..4bb9aa495577 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -635,7 +635,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, let fty = ty::mk_bare_fn(ccx.tcx, Some(def_id), ccx.tcx.mk_bare_fn(ty_method.fty.clone())); debug!("method {} (id {}) has type {}", - ident.repr(), id, fty.repr()); + ident, id, fty.repr()); ccx.tcx.tcache.borrow_mut().insert(def_id,TypeScheme { generics: ty_method.generics.clone(), ty: fty