diff options
| author | bors <bors@rust-lang.org> | 2015-04-08 00:42:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-08 00:42:10 +0000 |
| commit | dd6c4a8f15bc04dae7720af69d4a534d93c85c0a (patch) | |
| tree | 91364972fe3c0b803a71c085abcf3fb7e28085a0 /src/libcollections | |
| parent | d9146bf8ba0bdf98a46c4656899e54802e96ac0c (diff) | |
| parent | 97f24a85965c3c51a2c18be029091ae52bbd7920 (diff) | |
| download | rust-dd6c4a8f15bc04dae7720af69d4a534d93c85c0a.tar.gz rust-dd6c4a8f15bc04dae7720af69d4a534d93c85c0a.zip | |
Auto merge of #23293 - tbu-:pr_additive_multiplicative, r=alexcrichton
Previously it could not be implemented for types outside `libcore/iter.rs` due to coherence issues.
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/slice.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/str.rs | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index ff923fb1906..8622b8cd935 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -85,7 +85,6 @@ use core::clone::Clone; use core::cmp::Ordering::{self, Greater, Less}; use core::cmp::{self, Ord, PartialEq}; use core::iter::Iterator; -use core::iter::MultiplicativeIterator; use core::marker::Sized; use core::mem::size_of; use core::mem; @@ -1182,7 +1181,7 @@ impl Iterator for ElementSwaps { #[inline] fn size_hint(&self) -> (usize, Option<usize>) { // For a vector of size n, there are exactly n! permutations. - let n = (2..self.sdir.len() + 1).product(); + let n: usize = (2..self.sdir.len() + 1).product(); (n - self.swaps_made, Some(n - self.swaps_made)) } } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 28ba7369d52..98f2933effc 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -53,7 +53,6 @@ use self::RecompositionState::*; use self::DecompositionType::*; use core::clone::Clone; -use core::iter::AdditiveIterator; use core::iter::{Iterator, Extend}; use core::option::Option::{self, Some, None}; use core::result::Result; @@ -116,7 +115,7 @@ impl<S: AsRef<str>> SliceConcatExt<str, String> for [S] { // this is wrong without the guarantee that `self` is non-empty // `len` calculation may overflow but push_str but will check boundaries let len = sep.len() * (self.len() - 1) - + self.iter().map(|s| s.as_ref().len()).sum(); + + self.iter().map(|s| s.as_ref().len()).sum::<usize>(); let mut result = String::with_capacity(len); let mut first = true; |
