Skip to content

Commit

Permalink
Remove unnecessary Hash bounds from various types.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Oct 21, 2019
1 parent 77c50dc commit c3b3a86
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/cache.rs
Expand Up @@ -161,7 +161,7 @@ impl Ord for Interned<String> {
}
}

struct TyIntern<T: Hash + Clone + Eq> {
struct TyIntern<T: Clone + Eq> {
items: Vec<T>,
set: HashMap<T, Interned<T>>,
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/ty/fast_reject.rs
Expand Up @@ -19,7 +19,7 @@ pub type SimplifiedType = SimplifiedTypeGen<DefId>;
/// the non-stable but fast to construct DefId-version is the better choice.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, RustcEncodable, RustcDecodable)]
pub enum SimplifiedTypeGen<D>
where D: Copy + Debug + Ord + Eq + Hash
where D: Copy + Debug + Ord + Eq
{
BoolSimplifiedType,
CharSimplifiedType,
Expand Down Expand Up @@ -123,10 +123,10 @@ pub fn simplify_type(
}
}

impl<D: Copy + Debug + Ord + Eq + Hash> SimplifiedTypeGen<D> {
impl<D: Copy + Debug + Ord + Eq> SimplifiedTypeGen<D> {
pub fn map_def<U, F>(self, map: F) -> SimplifiedTypeGen<U>
where F: Fn(D) -> U,
U: Copy + Debug + Ord + Eq + Hash,
U: Copy + Debug + Ord + Eq,
{
match self {
BoolSimplifiedType => BoolSimplifiedType,
Expand Down Expand Up @@ -155,7 +155,7 @@ impl<D: Copy + Debug + Ord + Eq + Hash> SimplifiedTypeGen<D> {

impl<'a, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D>
where
D: Copy + Debug + Ord + Eq + Hash + HashStable<StableHashingContext<'a>>,
D: Copy + Debug + Ord + Eq + HashStable<StableHashingContext<'a>>,
{
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
mem::discriminant(self).hash_stable(hcx, hasher);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/sharded.rs
Expand Up @@ -90,7 +90,7 @@ impl<T> Sharded<T> {

pub type ShardedHashMap<K, V> = Sharded<FxHashMap<K, V>>;

impl<K: Eq + Hash, V> ShardedHashMap<K, V> {
impl<K: Eq, V> ShardedHashMap<K, V> {
pub fn len(&self) -> usize {
self.lock_shards().iter().map(|shard| shard.len()).sum()
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/snapshot_map/mod.rs
Expand Up @@ -7,7 +7,7 @@ use std::mem;
mod tests;

pub struct SnapshotMap<K, V>
where K: Hash + Clone + Eq
where K: Clone + Eq
{
map: FxHashMap<K, V>,
undo_log: Vec<UndoLog<K, V>>,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_data_structures/stable_hasher.rs
Expand Up @@ -460,7 +460,7 @@ impl_stable_hash_via_hash!(::std::path::Path);
impl_stable_hash_via_hash!(::std::path::PathBuf);

impl<K, V, R, HCX> HashStable<HCX> for ::std::collections::HashMap<K, V, R>
where K: ToStableHashKey<HCX> + Eq + Hash,
where K: ToStableHashKey<HCX> + Eq,
V: HashStable<HCX>,
R: BuildHasher,
{
Expand All @@ -471,7 +471,7 @@ impl<K, V, R, HCX> HashStable<HCX> for ::std::collections::HashMap<K, V, R>
}

impl<K, R, HCX> HashStable<HCX> for ::std::collections::HashSet<K, R>
where K: ToStableHashKey<HCX> + Eq + Hash,
where K: ToStableHashKey<HCX> + Eq,
R: BuildHasher,
{
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
Expand Down Expand Up @@ -513,7 +513,7 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>(
hasher: &mut StableHasher,
map: &::std::collections::HashMap<K, V, R>,
to_stable_hash_key: F)
where K: Eq + Hash,
where K: Eq,
V: HashStable<HCX>,
R: BuildHasher,
SK: HashStable<HCX> + Ord + Clone,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/borrow_check/nll/member_constraints.rs
Expand Up @@ -11,7 +11,7 @@ use syntax_pos::Span;
/// indexed by the region `R0`.
crate struct MemberConstraintSet<'tcx, R>
where
R: Copy + Hash + Eq,
R: Copy + Eq,
{
/// Stores the first "member" constraint for a given `R0`. This is an
/// index into the `constraints` vector below.
Expand Down Expand Up @@ -191,7 +191,7 @@ where

impl<'tcx, R> Index<NllMemberConstraintIndex> for MemberConstraintSet<'tcx, R>
where
R: Copy + Hash + Eq,
R: Copy + Eq,
{
type Output = NllMemberConstraint<'tcx>;

Expand Down
4 changes: 2 additions & 2 deletions src/libserialize/collection_impls.rs
Expand Up @@ -143,7 +143,7 @@ impl<T> Decodable for BTreeSet<T>
}

impl<K, V, S> Encodable for HashMap<K, V, S>
where K: Encodable + Hash + Eq,
where K: Encodable + Eq,
V: Encodable,
S: BuildHasher,
{
Expand Down Expand Up @@ -180,7 +180,7 @@ impl<K, V, S> Decodable for HashMap<K, V, S>
}

impl<T, S> Encodable for HashSet<T, S>
where T: Encodable + Hash + Eq,
where T: Encodable + Eq,
S: BuildHasher,
{
fn encode<E: Encoder>(&self, s: &mut E) -> Result<(), E::Error> {
Expand Down

0 comments on commit c3b3a86

Please sign in to comment.