Remove needless returns

Fixes clippy warning "unneeded `return` statement".

BUG=None
TEST=bin/clippy

Change-Id: Ib31ce9c31d4edccd9c3a518dfa3a07186124d259
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2885783
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Daniel Verkamp 2021-05-07 13:18:51 -07:00 committed by Commit Bot
parent 15fadba6ea
commit 3638ae21f8
8 changed files with 6 additions and 12 deletions

View file

@ -37,7 +37,6 @@ SUPPRESS=(
let_unit_value
missing_safety_doc
needless_range_loop
needless_return
option_map_unit_fn
question_mark
range_plus_one

View file

@ -193,7 +193,7 @@ impl Ac97Dev {
.map_err(|e| pci_device::Error::CreateViosClientFailed(e))?,
);
let vios_audio = Self::new(mem, Ac97Backend::VIOS, server);
return Ok(vios_audio);
Ok(vios_audio)
}
#[cfg(not(any(target_os = "linux", target_os = "android")))]
Err(pci_device::Error::CreateViosClientFailed(

View file

@ -80,7 +80,7 @@ fn memory_offset(mem: &GuestMemory, guest_addr: GuestAddress, len: u64) -> Udmab
return Err(GuestMemoryError::InvalidGuestAddress(guest_addr));
}
return Ok(memfd_offset + map_offset);
Ok(memfd_offset + map_offset)
})
.map_err(UdmabufError::InvalidOffset)
}

View file

@ -161,7 +161,6 @@ impl VirtioDevice for Block {
match worker_result {
Err(e) => {
error!("failed to spawn vhost-user virtio_blk worker: {}", e);
return;
}
Ok(join_handle) => {
self.worker_thread = Some(join_handle);

View file

@ -160,7 +160,6 @@ impl VirtioDevice for Fs {
match worker_result {
Err(e) => {
error!("failed to spawn vhost-user virtio_fs worker: {}", e);
return;
}
Ok(join_handle) => {
self.worker_thread = Some(join_handle);

View file

@ -166,7 +166,6 @@ impl VirtioDevice for Net {
match worker_result {
Err(e) => {
error!("failed to spawn virtio_net worker: {}", e);
return;
}
Ok(join_handle) => {
self.worker_thread = Some(join_handle);

View file

@ -256,7 +256,7 @@ impl RutabagaContext for CrossDomainContext {
impl RutabagaComponent for CrossDomain {
fn get_capset_info(&self, _capset_id: u32) -> (u32, u32) {
return (0u32, size_of::<CrossDomainCapabilities>() as u32);
(0u32, size_of::<CrossDomainCapabilities>() as u32)
}
fn get_capset(&self, _capset_id: u32, _version: u32) -> Vec<u8> {

View file

@ -409,11 +409,9 @@ mod tests {
fn request_help() {
let arguments = [Argument::short_flag('h', "help", "Print help message.")];
let match_res = set_arguments(["-h"].iter(), &arguments[..], |name, _| {
match name {
"help" => return Err(Error::PrintHelp),
_ => unreachable!(),
};
let match_res = set_arguments(["-h"].iter(), &arguments[..], |name, _| match name {
"help" => Err(Error::PrintHelp),
_ => unreachable!(),
});
match match_res {
Err(Error::PrintHelp) => {}