diff options
| author | bors <bors@rust-lang.org> | 2016-12-21 15:30:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-21 15:30:20 +0000 |
| commit | 5fbf3bf841cbe666bbee0e682f60d9d5c74ca709 (patch) | |
| tree | a64dda6cdc14da1b075c2db1365146ef7770e8c9 /src/libcollections/string.rs | |
| parent | 1b38776c1f68c6fd47c1b2f7b7974efc7dd64901 (diff) | |
| parent | 6414e67dbaa27f8638b01a33f49e462e87ecfab3 (diff) | |
Auto merge of #38488 - srinivasreddy:rf_collections, r=aturon
run rustfmt on libcollections folder
Diffstat (limited to 'src/libcollections/string.rs')
| -rw-r--r-- | src/libcollections/string.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index b4c41a99a6b..157c762b4a7 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -542,11 +542,7 @@ impl String { unsafe { *xs.get_unchecked(i) } } fn safe_get(xs: &[u8], i: usize, total: usize) -> u8 { - if i >= total { - 0 - } else { - unsafe_get(xs, i) - } + if i >= total { 0 } else { unsafe_get(xs, i) } } let mut res = String::with_capacity(total); @@ -976,7 +972,7 @@ impl String { pub fn push(&mut self, ch: char) { match ch.len_utf8() { 1 => self.vec.push(ch as u8), - _ => self.vec.extend_from_slice(ch.encode_utf8(&mut [0;4]).as_bytes()), + _ => self.vec.extend_from_slice(ch.encode_utf8(&mut [0; 4]).as_bytes()), } } @@ -1935,7 +1931,7 @@ impl<'a> FromIterator<String> for Cow<'a, str> { #[stable(feature = "from_string_for_vec_u8", since = "1.14.0")] impl From<String> for Vec<u8> { - fn from(string : String) -> Vec<u8> { + fn from(string: String) -> Vec<u8> { string.into_bytes() } } |
