From 94d75013bcf6fc8e79cd7c0c76c37e68c458db6f Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 13 Sep 2016 08:40:14 -0400 Subject: [PATCH] Remove redundant sorting of projections in TypeIdHasher. --- src/librustc/ty/util.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 6b3ebaa895fa..c6020838b532 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -458,15 +458,11 @@ impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx> { data.region_bound.visit_with(self); self.hash(data.builtin_bounds); - // Only projection bounds are left, sort and hash them. - let mut projection_bounds: Vec<_> = data.projection_bounds - .iter() - .map(|b| (b.item_name().as_str(), b)) - .collect(); - projection_bounds.sort_by_key(|&(ref name, _)| name.clone()); - for (name, bound) in projection_bounds { + // Only projection bounds are left, hash them. + self.hash(data.projection_bounds.len()); + for bound in &data.projection_bounds { self.def_id(bound.0.trait_ref.def_id); - self.hash(name); + self.hash(bound.0.item_name); bound.visit_with(self); }