mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-07 04:23:30 +00:00
std: Iterator.chain_ -> .chain
This commit is contained in:
parent
60c2661684
commit
1db62d8311
@ -366,12 +366,12 @@ pub fn make_mono_id(ccx: @mut CrateContext,
|
||||
param_uses: Option<@~[type_use::type_uses]>) -> mono_id {
|
||||
// FIXME (possibly #5801): Need a lot of type hints to get
|
||||
// .collect() to work.
|
||||
let substs_iter = substs.self_ty.iter().chain_(substs.tys.iter());
|
||||
let substs_iter = substs.self_ty.iter().chain(substs.tys.iter());
|
||||
let precise_param_ids: ~[(ty::t, Option<@~[mono_id]>)] = match substs.vtables {
|
||||
Some(vts) => {
|
||||
debug!("make_mono_id vtables=%s substs=%s",
|
||||
vts.repr(ccx.tcx), substs.tys.repr(ccx.tcx));
|
||||
let vts_iter = substs.self_vtables.iter().chain_(vts.iter());
|
||||
let vts_iter = substs.self_vtables.iter().chain(vts.iter());
|
||||
vts_iter.zip(substs_iter).map(|(vtable, subst)| {
|
||||
let v = vtable.map(|vt| meth::vtable_id(ccx, vt));
|
||||
(*subst, if !v.is_empty() { Some(@v) } else { None })
|
||||
@ -387,7 +387,7 @@ pub fn make_mono_id(ccx: @mut CrateContext,
|
||||
// We just say it is fully used.
|
||||
let self_use =
|
||||
substs.self_ty.map(|_| type_use::use_repr|type_use::use_tydesc);
|
||||
let uses_iter = self_use.iter().chain_(uses.iter());
|
||||
let uses_iter = self_use.iter().chain(uses.iter());
|
||||
|
||||
precise_param_ids.iter().zip(uses_iter).map(|(id, uses)| {
|
||||
if ccx.sess.no_monomorphic_collapse() {
|
||||
|
@ -724,7 +724,7 @@ impl<T:Hash + Eq> HashSet<T> {
|
||||
/// Visit the values representing the symmetric difference
|
||||
pub fn symmetric_difference_iter<'a>(&'a self, other: &'a HashSet<T>)
|
||||
-> Chain<SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
|
||||
self.difference_iter(other).chain_(other.difference_iter(self))
|
||||
self.difference_iter(other).chain(other.difference_iter(self))
|
||||
}
|
||||
|
||||
/// Visit the values representing the intersection
|
||||
@ -740,7 +740,7 @@ impl<T:Hash + Eq> HashSet<T> {
|
||||
/// Visit the values representing the union
|
||||
pub fn union_iter<'a>(&'a self, other: &'a HashSet<T>)
|
||||
-> Chain<HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
|
||||
self.iter().chain_(other.difference_iter(self))
|
||||
self.iter().chain(other.difference_iter(self))
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,13 +59,13 @@ pub trait Iterator<A> {
|
||||
/// ~~~ {.rust}
|
||||
/// let a = [0];
|
||||
/// let b = [1];
|
||||
/// let mut it = a.iter().chain_(b.iter());
|
||||
/// let mut it = a.iter().chain(b.iter());
|
||||
/// assert_eq!(it.next().get(), &0);
|
||||
/// assert_eq!(it.next().get(), &1);
|
||||
/// assert!(it.next().is_none());
|
||||
/// ~~~
|
||||
#[inline]
|
||||
fn chain_<U: Iterator<A>>(self, other: U) -> Chain<Self, U> {
|
||||
fn chain<U: Iterator<A>>(self, other: U) -> Chain<Self, U> {
|
||||
Chain{a: self, b: other, flag: false}
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ mod tests {
|
||||
let xs = [0u, 1, 2, 3, 4, 5];
|
||||
let ys = [30u, 40, 50, 60];
|
||||
let expected = [0, 1, 2, 3, 4, 5, 30, 40, 50, 60];
|
||||
let mut it = xs.iter().chain_(ys.iter());
|
||||
let mut it = xs.iter().chain(ys.iter());
|
||||
let mut i = 0;
|
||||
for &x in it {
|
||||
assert_eq!(x, expected[i]);
|
||||
@ -1543,7 +1543,7 @@ mod tests {
|
||||
assert_eq!(i, expected.len());
|
||||
|
||||
let ys = count(30u, 10).take(4);
|
||||
let mut it = xs.iter().map(|&x| x).chain_(ys);
|
||||
let mut it = xs.iter().map(|&x| x).chain(ys);
|
||||
let mut i = 0;
|
||||
for x in it {
|
||||
assert_eq!(x, expected[i]);
|
||||
@ -1771,7 +1771,7 @@ mod tests {
|
||||
assert_eq!(c.take_while(|_| false).size_hint(), (0, None));
|
||||
assert_eq!(c.skip_while(|_| false).size_hint(), (0, None));
|
||||
assert_eq!(c.enumerate().size_hint(), (uint::max_value, None));
|
||||
assert_eq!(c.chain_(vi.map(|&i| i)).size_hint(), (uint::max_value, None));
|
||||
assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::max_value, None));
|
||||
assert_eq!(c.zip(vi).size_hint(), (10, Some(10)));
|
||||
assert_eq!(c.scan(0, |_,_| Some(0)).size_hint(), (0, None));
|
||||
assert_eq!(c.filter(|_| false).size_hint(), (0, None));
|
||||
@ -1785,7 +1785,7 @@ mod tests {
|
||||
assert_eq!(vi.take_while(|_| false).size_hint(), (0, Some(10)));
|
||||
assert_eq!(vi.skip_while(|_| false).size_hint(), (0, Some(10)));
|
||||
assert_eq!(vi.enumerate().size_hint(), (10, Some(10)));
|
||||
assert_eq!(vi.chain_(v2.iter()).size_hint(), (13, Some(13)));
|
||||
assert_eq!(vi.chain(v2.iter()).size_hint(), (13, Some(13)));
|
||||
assert_eq!(vi.zip(v2.iter()).size_hint(), (3, Some(3)));
|
||||
assert_eq!(vi.scan(0, |_,_| Some(0)).size_hint(), (0, Some(10)));
|
||||
assert_eq!(vi.filter(|_| false).size_hint(), (0, Some(10)));
|
||||
@ -1900,7 +1900,7 @@ mod tests {
|
||||
fn test_double_ended_chain() {
|
||||
let xs = [1, 2, 3, 4, 5];
|
||||
let ys = ~[7, 9, 11];
|
||||
let mut it = xs.iter().chain_(ys.iter()).invert();
|
||||
let mut it = xs.iter().chain(ys.iter()).invert();
|
||||
assert_eq!(it.next().unwrap(), &11)
|
||||
assert_eq!(it.next().unwrap(), &9)
|
||||
assert_eq!(it.next_back().unwrap(), &1)
|
||||
@ -1953,7 +1953,7 @@ mod tests {
|
||||
fn test_random_access_chain() {
|
||||
let xs = [1, 2, 3, 4, 5];
|
||||
let ys = ~[7, 9, 11];
|
||||
let mut it = xs.iter().chain_(ys.iter());
|
||||
let mut it = xs.iter().chain(ys.iter());
|
||||
assert_eq!(it.idx(0).unwrap(), &1);
|
||||
assert_eq!(it.idx(5).unwrap(), &7);
|
||||
assert_eq!(it.idx(7).unwrap(), &11);
|
||||
|
@ -576,7 +576,7 @@ impl Context {
|
||||
}
|
||||
|
||||
let args = names.move_iter().map(|a| a.unwrap());
|
||||
let mut args = locals.move_iter().chain_(args);
|
||||
let mut args = locals.move_iter().chain(args);
|
||||
|
||||
// Next, build up the actual call to the sprintf function.
|
||||
let result = self.ecx.expr_call_global(self.fmtsp, ~[
|
||||
|
Loading…
Reference in New Issue
Block a user