mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 10:10:41 +00:00
clippy: Resolve redundant_closure
TEST=bin/clippy Change-Id: Id4f38956d788e4402df164df03e80c4b487b1ad6 Reviewed-on: https://chromium-review.googlesource.com/1566745 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
56c2d3631c
commit
5fb3f51517
7 changed files with 12 additions and 13 deletions
|
@ -16,7 +16,6 @@ SUPPRESS=(
|
|||
let_unit_value
|
||||
question_mark
|
||||
range_plus_one
|
||||
redundant_closure
|
||||
redundant_pattern_matching
|
||||
single_match
|
||||
string_lit_as_bytes
|
||||
|
|
|
@ -367,7 +367,7 @@ impl Backend {
|
|||
.get(&id)
|
||||
.and_then(|resource| resource.buffer())
|
||||
.and_then(|buffer| buffer.export_plane_fd(0).ok())
|
||||
.map(|fd| ResourceResponse::Resource(fd))
|
||||
.map(ResourceResponse::Resource)
|
||||
.unwrap_or(ResourceResponse::Invalid),
|
||||
};
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ where
|
|||
let read = self
|
||||
.source
|
||||
.read(&mut self.read_buffer.buffer[self.read_idx..])
|
||||
.map_err(|e| InputError::EventsReadError(e))?;
|
||||
.map_err(InputError::EventsReadError)?;
|
||||
let buff_size = read + self.read_idx;
|
||||
|
||||
for evt_slice in self.read_buffer.buffer[..buff_size].chunks_exact(input_event::EVENT_SIZE)
|
||||
|
|
|
@ -460,7 +460,7 @@ impl<T: EventSource> Worker<T> {
|
|||
} else {
|
||||
self.guest_memory
|
||||
.write_from_memory(avail_desc.addr, &mut self.event_source, len)
|
||||
.map_err(|e| InputError::EventsWriteError(e))?;
|
||||
.map_err(InputError::EventsWriteError)?;
|
||||
}
|
||||
|
||||
used_desc_heads[used_count] = (avail_desc.index, len);
|
||||
|
|
|
@ -250,7 +250,7 @@ impl VirtioPciDevice {
|
|||
);
|
||||
self.config_regs
|
||||
.add_capability(&common_cap)
|
||||
.map_err(|e| PciDeviceError::CapabilitiesSetup(e))?;
|
||||
.map_err(PciDeviceError::CapabilitiesSetup)?;
|
||||
|
||||
let isr_cap = VirtioPciCap::new(
|
||||
PciCapabilityType::IsrConfig,
|
||||
|
@ -260,7 +260,7 @@ impl VirtioPciDevice {
|
|||
);
|
||||
self.config_regs
|
||||
.add_capability(&isr_cap)
|
||||
.map_err(|e| PciDeviceError::CapabilitiesSetup(e))?;
|
||||
.map_err(PciDeviceError::CapabilitiesSetup)?;
|
||||
|
||||
// TODO(dgreid) - set based on device's configuration size?
|
||||
let device_cap = VirtioPciCap::new(
|
||||
|
@ -271,7 +271,7 @@ impl VirtioPciDevice {
|
|||
);
|
||||
self.config_regs
|
||||
.add_capability(&device_cap)
|
||||
.map_err(|e| PciDeviceError::CapabilitiesSetup(e))?;
|
||||
.map_err(PciDeviceError::CapabilitiesSetup)?;
|
||||
|
||||
let notify_cap = VirtioPciNotifyCap::new(
|
||||
PciCapabilityType::NotifyConfig,
|
||||
|
@ -282,13 +282,13 @@ impl VirtioPciDevice {
|
|||
);
|
||||
self.config_regs
|
||||
.add_capability(¬ify_cap)
|
||||
.map_err(|e| PciDeviceError::CapabilitiesSetup(e))?;
|
||||
.map_err(PciDeviceError::CapabilitiesSetup)?;
|
||||
|
||||
//TODO(dgreid) - How will the configuration_cap work?
|
||||
let configuration_cap = VirtioPciCap::new(PciCapabilityType::PciConfig, 0, 0, 0);
|
||||
self.config_regs
|
||||
.add_capability(&configuration_cap)
|
||||
.map_err(|e| PciDeviceError::CapabilitiesSetup(e))?;
|
||||
.map_err(PciDeviceError::CapabilitiesSetup)?;
|
||||
|
||||
self.settings_bar = settings_bar;
|
||||
Ok(())
|
||||
|
@ -372,7 +372,7 @@ impl PciDevice for VirtioPciDevice {
|
|||
for cap in self.device.get_device_caps() {
|
||||
self.config_regs
|
||||
.add_capability(&*cap)
|
||||
.map_err(|e| PciDeviceError::CapabilitiesSetup(e))?;
|
||||
.map_err(PciDeviceError::CapabilitiesSetup)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -1087,7 +1087,7 @@ pub fn run_config(cfg: Config) -> Result<()> {
|
|||
}
|
||||
|
||||
let (usb_control_socket, usb_provider) =
|
||||
HostBackendDeviceProvider::new().map_err(|e| Error::CreateUsbProvider(e))?;
|
||||
HostBackendDeviceProvider::new().map_err(Error::CreateUsbProvider)?;
|
||||
// Masking signals is inherently dangerous, since this can persist across clones/execs. Do this
|
||||
// before any jailed devices have been spawned, so that we can catch any of them that fail very
|
||||
// quickly.
|
||||
|
|
|
@ -1047,7 +1047,7 @@ fn raw_fd_from_path(path: &Path) -> ModifyUsbResult<RawFd> {
|
|||
})
|
||||
},
|
||||
)?;
|
||||
validate_raw_fd(raw_fd).map_err(|e| ModifyUsbError::FailedFdValidate(e))
|
||||
validate_raw_fd(raw_fd).map_err(ModifyUsbError::FailedFdValidate)
|
||||
}
|
||||
|
||||
fn usb_attach(mut args: std::env::Args) -> ModifyUsbResult<UsbControlResult> {
|
||||
|
@ -1080,7 +1080,7 @@ fn usb_attach(mut args: std::env::Args) -> ModifyUsbResult<UsbControlResult> {
|
|||
addr,
|
||||
vid,
|
||||
pid,
|
||||
fd: usb_file.map(|f| MaybeOwnedFd::Owned(f)),
|
||||
fd: usb_file.map(MaybeOwnedFd::Owned),
|
||||
});
|
||||
let response = handle_request(&request, args).map_err(|_| ModifyUsbError::SocketFailed)?;
|
||||
match response {
|
||||
|
|
Loading…
Reference in a new issue