Rollup merge of #53059 - ljedrz:unneeded_returns, r=kennytm
Remove explicit returns where unnecessary
This commit is contained in:
commit
28e1a7ba5e
|
@ -217,7 +217,7 @@ impl Layout {
|
||||||
|
|
||||||
let len_rounded_up = len.wrapping_add(align).wrapping_sub(1)
|
let len_rounded_up = len.wrapping_add(align).wrapping_sub(1)
|
||||||
& !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
|
/// 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()]
|
// _l <= layout.size() [guaranteed by usable_size()]
|
||||||
// layout.size() <= new_layout.size() [required by this method]
|
// layout.size() <= new_layout.size() [required by this method]
|
||||||
if new_size <= u {
|
if new_size <= u {
|
||||||
return Ok(());
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
return Err(CannotReallocInPlace);
|
Err(CannotReallocInPlace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,9 +1026,9 @@ pub unsafe trait Alloc {
|
||||||
// layout.size() <= _u [guaranteed by usable_size()]
|
// layout.size() <= _u [guaranteed by usable_size()]
|
||||||
// new_layout.size() <= layout.size() [required by this method]
|
// new_layout.size() <= layout.size() [required by this method]
|
||||||
if l <= new_size {
|
if l <= new_size {
|
||||||
return Ok(());
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
return Err(CannotReallocInPlace);
|
Err(CannotReallocInPlace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,8 +312,8 @@ impl Iterator for EscapeDefault {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EscapeDefaultState::Done => return None,
|
EscapeDefaultState::Done => None,
|
||||||
EscapeDefaultState::Unicode(ref mut i) => return i.nth(n),
|
EscapeDefaultState::Unicode(ref mut i) => i.nth(n),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2318,7 +2318,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];
|
let table_inverse = INV_TABLE_MOD_16[(x & (INV_TABLE_MOD - 1)) >> 1];
|
||||||
if m <= INV_TABLE_MOD {
|
if m <= INV_TABLE_MOD {
|
||||||
return table_inverse & (m - 1);
|
table_inverse & (m - 1)
|
||||||
} else {
|
} else {
|
||||||
// We iterate "up" using the following formula:
|
// We iterate "up" using the following formula:
|
||||||
//
|
//
|
||||||
|
@ -2405,7 +2405,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cannot be aligned at all.
|
// 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);
|
ctz_b = ::intrinsics::cttz_nonzero(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return a << k;
|
a << k
|
||||||
}
|
}
|
||||||
let gcd: usize = gcd(::mem::size_of::<T>(), ::mem::size_of::<U>());
|
let gcd: usize = gcd(::mem::size_of::<T>(), ::mem::size_of::<U>());
|
||||||
let ts: usize = ::mem::size_of::<U>() / gcd;
|
let ts: usize = ::mem::size_of::<U>() / gcd;
|
||||||
|
@ -1737,7 +1737,7 @@ impl<T> [T] {
|
||||||
let us_len = self.len() / ts * us;
|
let us_len = self.len() / ts * us;
|
||||||
// And how many `T`s will be in the trailing slice!
|
// And how many `T`s will be in the trailing slice!
|
||||||
let ts_len = self.len() % ts;
|
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
|
/// 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 ptr = self.as_ptr();
|
||||||
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
|
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
|
||||||
if offset > self.len() {
|
if offset > self.len() {
|
||||||
return (self, &[], &[]);
|
(self, &[], &[])
|
||||||
} else {
|
} else {
|
||||||
let (left, rest) = self.split_at(offset);
|
let (left, rest) = self.split_at(offset);
|
||||||
let (us_len, ts_len) = rest.align_to_offsets::<U>();
|
let (us_len, ts_len) = rest.align_to_offsets::<U>();
|
||||||
return (left,
|
(left,
|
||||||
from_raw_parts(rest.as_ptr() as *const U, us_len),
|
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))
|
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 ptr = self.as_ptr();
|
||||||
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
|
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
|
||||||
if offset > self.len() {
|
if offset > self.len() {
|
||||||
return (self, &mut [], &mut []);
|
(self, &mut [], &mut [])
|
||||||
} else {
|
} else {
|
||||||
let (left, rest) = self.split_at_mut(offset);
|
let (left, rest) = self.split_at_mut(offset);
|
||||||
let (us_len, ts_len) = rest.align_to_offsets::<U>();
|
let (us_len, ts_len) = rest.align_to_offsets::<U>();
|
||||||
let mut_ptr = rest.as_mut_ptr();
|
let mut_ptr = rest.as_mut_ptr();
|
||||||
return (left,
|
(left,
|
||||||
from_raw_parts_mut(mut_ptr as *mut U, us_len),
|
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))
|
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: &[],
|
broken: &[],
|
||||||
};
|
};
|
||||||
self.source = &[];
|
self.source = &[];
|
||||||
return Some(r);
|
Some(r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1567,7 +1567,7 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [
|
||||||
#[unstable(feature = "str_internals", issue = "0")]
|
#[unstable(feature = "str_internals", issue = "0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn utf8_char_width(b: u8) -> usize {
|
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.
|
/// 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),
|
t!(io::copy(&mut io.take(amt),
|
||||||
&mut t!(File::create(&dst))));
|
&mut t!(File::create(&dst))));
|
||||||
t!(fs::set_permissions(&dst, Permissions::from_mode(0o755)));
|
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>) {
|
fn my_copy(src: &mut dyn Read, which: u8, dst: &Mutex<dyn Write>) {
|
||||||
|
|
Loading…
Reference in New Issue