Skip to content

Remove no longer necessary coercions to fn pointer types. #32612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,6 @@ impl<K, V, S> HashMap<K, V, S>
#[stable(feature = "rust1", since = "1.0.0")]
pub fn keys<'a>(&'a self) -> Keys<'a, K, V> {
fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((&'a K,&'a V)) -> &'a K = first; // coerce to fn ptr

Keys { inner: self.iter().map(first) }
}

Expand All @@ -862,8 +860,6 @@ impl<K, V, S> HashMap<K, V, S>
#[stable(feature = "rust1", since = "1.0.0")]
pub fn values<'a>(&'a self) -> Values<'a, K, V> {
fn second<A, B>((_, b): (A, B)) -> B { b }
let second: fn((&'a K,&'a V)) -> &'a V = second; // coerce to fn ptr

Values { inner: self.iter().map(second) }
}

Expand Down Expand Up @@ -997,8 +993,6 @@ impl<K, V, S> HashMap<K, V, S>
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<K, V> {
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; // coerce to fn pointer

Drain {
inner: self.table.drain().map(last_two),
}
Expand Down Expand Up @@ -1404,8 +1398,6 @@ impl<K, V, S> IntoIterator for HashMap<K, V, S>
/// ```
fn into_iter(self) -> IntoIter<K, V> {
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two;

IntoIter {
inner: self.table.into_iter().map(last_two)
}
Expand Down
4 changes: 0 additions & 4 deletions src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,6 @@ impl<T, S> HashSet<T, S>
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<T> {
fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((T, ())) -> T = first; // coerce to fn pointer

Drain { iter: self.map.drain().map(first) }
}

Expand Down Expand Up @@ -892,8 +890,6 @@ impl<T, S> IntoIterator for HashSet<T, S>
/// ```
fn into_iter(self) -> IntoIter<T> {
fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((T, ())) -> T = first;

IntoIter { iter: self.map.into_iter().map(first) }
}
}
Expand Down