diff options
| author | Nathan West <Lucretiel@gmail.com> | 2018-12-05 15:11:32 -0800 |
|---|---|---|
| committer | Nathan West <Lucretiel@gmail.com> | 2018-12-05 15:11:32 -0800 |
| commit | 823dd8ca334951962e8b192ca1362c08e33d6bcf (patch) | |
| tree | 3846dedd64476a493b88870e729f68138dcfae1a /src/liballoc/string.rs | |
| parent | 180dcc3118998ebbe390f876df51f85f1b33407a (diff) | |
| download | rust-823dd8ca334951962e8b192ca1362c08e33d6bcf.tar.gz rust-823dd8ca334951962e8b192ca1362c08e33d6bcf.zip | |
Fixed mutability
Diffstat (limited to 'src/liballoc/string.rs')
| -rw-r--r-- | src/liballoc/string.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index ef9a34ec611..6962f2ba852 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1732,11 +1732,11 @@ impl<'a> FromIterator<&'a str> for String { #[stable(feature = "extend_string", since = "1.4.0")] impl FromIterator<String> for String { fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> String { - let iterator = iter.into_iter(); + let mut iterator = iter.into_iter(); match iterator.next() { None => String::new(), - Some(buf) => { + Some(mut buf) => { buf.extend(iterator); buf } @@ -1747,12 +1747,12 @@ impl FromIterator<String> for String { #[stable(feature = "herd_cows", since = "1.19.0")] impl<'a> FromIterator<Cow<'a, str>> for String { fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String { - let iterator = iter.into_iter(); + let mut iterator = iter.into_iter(); match iterator.next() { None => String::new(), Some(cow) => { - let buf = cow.into_owned(); + let mut buf = cow.into_owned(); buf.extend(iterator); buf } |
