run rustfmt on libcollections folder

This commit is contained in:
Srinivas Reddy Thatiparthy 2016-12-20 09:54:00 +05:30
parent 94ae2a2e67
commit 6414e67dba
No known key found for this signature in database
GPG key ID: 091C58F4BFC36571
7 changed files with 103 additions and 95 deletions

View file

@ -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()
}
}