rustc: remove some unused UserString and Repr impls.

This commit is contained in:
Eduard Burtescu 2015-06-17 09:53:07 +03:00
parent b510ea1487
commit af7daa0daf
3 changed files with 3 additions and 28 deletions

View File

@ -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<T:UserString> UserString for Vec<T> {
fn user_string(&self) -> String {
let strs: Vec<String> =
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)

View File

@ -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 };

View File

@ -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