libstd: fix fallout
This commit is contained in:
parent
0fcd730373
commit
d22acb77b2
@ -852,7 +852,9 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn keys(&self) -> Keys<K, V> {
|
||||
self.iter().map(|(k, _v)| k)
|
||||
fn first<A, B>((a, _): (A, B)) -> A { a }
|
||||
|
||||
self.iter().map(first)
|
||||
}
|
||||
|
||||
/// An iterator visiting all values in arbitrary order.
|
||||
@ -874,7 +876,9 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn values(&self) -> Values<K, V> {
|
||||
self.iter().map(|(_k, v)| v)
|
||||
fn second<A, B>((_, b): (A, B)) -> B { b }
|
||||
|
||||
self.iter().map(second)
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order.
|
||||
@ -946,8 +950,10 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn into_iter(self) -> MoveEntries<K, V> {
|
||||
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
|
||||
|
||||
MoveEntries {
|
||||
inner: self.table.into_iter().map(|(_, k, v)| (k, v))
|
||||
inner: self.table.into_iter().map(last_two)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,7 +1322,12 @@ pub struct MutEntries<'a, K: 'a, V: 'a> {
|
||||
|
||||
/// HashMap move iterator
|
||||
pub struct MoveEntries<K, V> {
|
||||
inner: iter::Map<'static, (SafeHash, K, V), (K, V), table::MoveEntries<K, V>>
|
||||
inner: iter::Map<
|
||||
(SafeHash, K, V),
|
||||
(K, V),
|
||||
table::MoveEntries<K, V>,
|
||||
fn((SafeHash, K, V)) -> (K, V),
|
||||
>
|
||||
}
|
||||
|
||||
/// A view into a single occupied location in a HashMap
|
||||
@ -1434,11 +1445,11 @@ impl<'a, K, V> VacantEntry<'a, K, V> {
|
||||
|
||||
/// HashMap keys iterator
|
||||
pub type Keys<'a, K, V> =
|
||||
iter::Map<'static, (&'a K, &'a V), &'a K, Entries<'a, K, V>>;
|
||||
iter::Map<(&'a K, &'a V), &'a K, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>;
|
||||
|
||||
/// HashMap values iterator
|
||||
pub type Values<'a, K, V> =
|
||||
iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>;
|
||||
iter::Map<(&'a K, &'a V), &'a V, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>;
|
||||
|
||||
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
|
||||
fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
|
||||
|
@ -277,7 +277,9 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn into_iter(self) -> SetMoveItems<T> {
|
||||
self.map.into_iter().map(|(k, _)| k)
|
||||
fn first<A, B>((a, _): (A, B)) -> A { a }
|
||||
|
||||
self.map.into_iter().map(first)
|
||||
}
|
||||
|
||||
/// Visit the values representing the difference.
|
||||
@ -611,11 +613,10 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Default for HashSet<T, H> {
|
||||
|
||||
/// HashSet iterator
|
||||
pub type SetItems<'a, K> =
|
||||
iter::Map<'static, (&'a K, &'a ()), &'a K, Entries<'a, K, ()>>;
|
||||
iter::Map<(&'a K, &'a ()), &'a K, Entries<'a, K, ()>, fn((&'a K, &'a ())) -> &'a K>;
|
||||
|
||||
/// HashSet move iterator
|
||||
pub type SetMoveItems<K> =
|
||||
iter::Map<'static, (K, ()), K, MoveEntries<K, ()>>;
|
||||
pub type SetMoveItems<K> = iter::Map<(K, ()), K, MoveEntries<K, ()>, fn((K, ())) -> K>;
|
||||
|
||||
// `Repeat` is used to feed the filter closure an explicit capture
|
||||
// of a reference to the other set
|
||||
|
@ -32,8 +32,8 @@ use super::{BytesContainer, GenericPath, GenericPathUnsafe};
|
||||
pub type Components<'a> = Splits<'a, u8>;
|
||||
|
||||
/// Iterator that yields successive components of a Path as Option<&str>
|
||||
pub type StrComponents<'a> = Map<'a, &'a [u8], Option<&'a str>,
|
||||
Components<'a>>;
|
||||
pub type StrComponents<'a> =
|
||||
Map<&'a [u8], Option<&'a str>, Components<'a>, fn(&[u8]) -> Option<&str>>;
|
||||
|
||||
/// Represents a POSIX file path
|
||||
#[deriving(Clone)]
|
||||
|
@ -38,12 +38,12 @@ use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe};
|
||||
///
|
||||
/// Each component is yielded as Option<&str> for compatibility with PosixPath, but
|
||||
/// every component in WindowsPath is guaranteed to be Some.
|
||||
pub type StrComponents<'a> = Map<'a, &'a str, Option<&'a str>,
|
||||
CharSplits<'a, char>>;
|
||||
pub type StrComponents<'a> =
|
||||
Map<&'a str, Option<&'a str>, CharSplits<'a, char>, fn(&'a str) -> Option<&'a str>>;
|
||||
|
||||
/// Iterator that yields successive components of a Path as &[u8]
|
||||
pub type Components<'a> = Map<'a, Option<&'a str>, &'a [u8],
|
||||
StrComponents<'a>>;
|
||||
pub type Components<'a> =
|
||||
Map<Option<&'a str>, &'a [u8], StrComponents<'a>, fn(Option<&str>) -> &[u8]>;
|
||||
|
||||
/// Represents a Windows path
|
||||
// Notes for Windows path impl:
|
||||
|
Loading…
x
Reference in New Issue
Block a user