Remove explicit returns where unnecessary
This commit is contained in:
parent
579adf8c72
commit
1667950d73
|
@ -217,7 +217,7 @@ impl Layout {
|
|||
|
||||
let len_rounded_up = len.wrapping_add(align).wrapping_sub(1)
|
||||
& !align.wrapping_sub(1);
|
||||
return len_rounded_up.wrapping_sub(len);
|
||||
len_rounded_up.wrapping_sub(len)
|
||||
}
|
||||
|
||||
/// Creates a layout describing the record for `n` instances of
|
||||
|
@ -971,9 +971,9 @@ pub unsafe trait Alloc {
|
|||
// _l <= layout.size() [guaranteed by usable_size()]
|
||||
// layout.size() <= new_layout.size() [required by this method]
|
||||
if new_size <= u {
|
||||
return Ok(());
|
||||
Ok(())
|
||||
} else {
|
||||
return Err(CannotReallocInPlace);
|
||||
Err(CannotReallocInPlace)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1026,9 +1026,9 @@ pub unsafe trait Alloc {
|
|||
// layout.size() <= _u [guaranteed by usable_size()]
|
||||
// new_layout.size() <= layout.size() [required by this method]
|
||||
if l <= new_size {
|
||||
return Ok(());
|
||||
Ok(())
|
||||
} else {
|
||||
return Err(CannotReallocInPlace);
|
||||
Err(CannotReallocInPlace)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -312,8 +312,8 @@ impl Iterator for EscapeDefault {
|
|||
None
|
||||
}
|
||||
},
|
||||
EscapeDefaultState::Done => return None,
|
||||
EscapeDefaultState::Unicode(ref mut i) => return i.nth(n),
|
||||
EscapeDefaultState::Done => None,
|
||||
EscapeDefaultState::Unicode(ref mut i) => i.nth(n),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2288,7 +2288,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
|
|||
|
||||
let table_inverse = INV_TABLE_MOD_16[(x & (INV_TABLE_MOD - 1)) >> 1];
|
||||
if m <= INV_TABLE_MOD {
|
||||
return table_inverse & (m - 1);
|
||||
table_inverse & (m - 1)
|
||||
} else {
|
||||
// We iterate "up" using the following formula:
|
||||
//
|
||||
|
@ -2375,7 +2375,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
|
|||
}
|
||||
|
||||
// Cannot be aligned at all.
|
||||
return usize::max_value();
|
||||
usize::max_value()
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1727,7 +1727,7 @@ impl<T> [T] {
|
|||
ctz_b = ::intrinsics::cttz_nonzero(b);
|
||||
}
|
||||
}
|
||||
return a << k;
|
||||
a << k
|
||||
}
|
||||
let gcd: usize = gcd(::mem::size_of::<T>(), ::mem::size_of::<U>());
|
||||
let ts: usize = ::mem::size_of::<U>() / gcd;
|
||||
|
@ -1737,7 +1737,7 @@ impl<T> [T] {
|
|||
let us_len = self.len() / ts * us;
|
||||
// And how many `T`s will be in the trailing slice!
|
||||
let ts_len = self.len() % ts;
|
||||
return (us_len, ts_len);
|
||||
(us_len, ts_len)
|
||||
}
|
||||
|
||||
/// Transmute the slice to a slice of another type, ensuring aligment of the types is
|
||||
|
@ -1782,13 +1782,13 @@ impl<T> [T] {
|
|||
let ptr = self.as_ptr();
|
||||
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
|
||||
if offset > self.len() {
|
||||
return (self, &[], &[]);
|
||||
(self, &[], &[])
|
||||
} else {
|
||||
let (left, rest) = self.split_at(offset);
|
||||
let (us_len, ts_len) = rest.align_to_offsets::<U>();
|
||||
return (left,
|
||||
from_raw_parts(rest.as_ptr() as *const U, us_len),
|
||||
from_raw_parts(rest.as_ptr().offset((rest.len() - ts_len) as isize), ts_len))
|
||||
(left,
|
||||
from_raw_parts(rest.as_ptr() as *const U, us_len),
|
||||
from_raw_parts(rest.as_ptr().offset((rest.len() - ts_len) as isize), ts_len))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1834,14 +1834,14 @@ impl<T> [T] {
|
|||
let ptr = self.as_ptr();
|
||||
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
|
||||
if offset > self.len() {
|
||||
return (self, &mut [], &mut []);
|
||||
(self, &mut [], &mut [])
|
||||
} else {
|
||||
let (left, rest) = self.split_at_mut(offset);
|
||||
let (us_len, ts_len) = rest.align_to_offsets::<U>();
|
||||
let mut_ptr = rest.as_mut_ptr();
|
||||
return (left,
|
||||
from_raw_parts_mut(mut_ptr as *mut U, us_len),
|
||||
from_raw_parts_mut(mut_ptr.offset((rest.len() - ts_len) as isize), ts_len))
|
||||
(left,
|
||||
from_raw_parts_mut(mut_ptr as *mut U, us_len),
|
||||
from_raw_parts_mut(mut_ptr.offset((rest.len() - ts_len) as isize), ts_len))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ impl<'a> Iterator for Utf8LossyChunksIter<'a> {
|
|||
broken: &[],
|
||||
};
|
||||
self.source = &[];
|
||||
return Some(r);
|
||||
Some(r)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1567,7 +1567,7 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [
|
|||
#[unstable(feature = "str_internals", issue = "0")]
|
||||
#[inline]
|
||||
pub fn utf8_char_width(b: u8) -> usize {
|
||||
return UTF8_CHAR_WIDTH[b as usize] as usize;
|
||||
UTF8_CHAR_WIDTH[b as usize] as usize
|
||||
}
|
||||
|
||||
/// Mask of the value bits of a continuation byte.
|
||||
|
|
|
@ -267,7 +267,7 @@ fn recv<B: BufRead>(dir: &Path, io: &mut B) -> PathBuf {
|
|||
t!(io::copy(&mut io.take(amt),
|
||||
&mut t!(File::create(&dst))));
|
||||
t!(fs::set_permissions(&dst, Permissions::from_mode(0o755)));
|
||||
return dst
|
||||
dst
|
||||
}
|
||||
|
||||
fn my_copy(src: &mut dyn Read, which: u8, dst: &Mutex<dyn Write>) {
|
||||
|
|
Loading…
Reference in New Issue