make Extend use IntoIterator

This breaks all implementors of Extend, as they must now accept IntoIterator instead of Iterator. The fix for this is generally trivial (change the bound, and maybe call into_iter() on the argument to get the old argument).

Users of Extend should be unaffected because Iterators are IntoIterator.

[breaking-change]
This commit is contained in:
Alexis
2015-02-18 10:04:30 -05:00
parent 5fa9de16df
commit 4a9d190423
16 changed files with 32 additions and 26 deletions

View File

@@ -110,7 +110,7 @@ use core::prelude::*;
use ascii::*;
use borrow::BorrowFrom;
use cmp;
use iter;
use iter::{self, IntoIterator};
use mem;
use ops::{self, Deref};
use string::CowString;
@@ -961,7 +961,7 @@ impl<'a, P: ?Sized + 'a> iter::FromIterator<&'a P> for PathBuf where P: AsPath {
}
impl<'a, P: ?Sized + 'a> iter::Extend<&'a P> for PathBuf where P: AsPath {
fn extend<I: Iterator<Item = &'a P>>(&mut self, iter: I) {
fn extend<I: IntoIterator<Item = &'a P>>(&mut self, iter: I) {
for p in iter {
self.push(p)
}