mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: clippy: add needless_pass_by_value
This is a follow-up of [0].
# Advantages
- This saves dozens of unneeded clone()s across the whole code base
- Makes it much easier to reason about how parameters are used
(often we passed owned Arc/Rc versions without actually needing
ownership)
# Exceptions
For certain code paths, the alternatives would require awkward or overly
complex code, and in some cases the functions are the logical owners of
the values they take. In those cases, I've added
#[allow(clippy::needless_pass_by_value)].
This does not mean that one should not improve this in the future.
[0] 6a86c157af
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
ed4af3a005
commit
c53781bf5f
@@ -10,8 +10,8 @@
|
||||
|
||||
use std::fs::File;
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::sync::Barrier;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Barrier};
|
||||
use std::thread;
|
||||
|
||||
use log::info;
|
||||
@@ -153,8 +153,8 @@ impl EpollHelper {
|
||||
|
||||
pub fn run(
|
||||
&mut self,
|
||||
paused: Arc<AtomicBool>,
|
||||
paused_sync: Arc<Barrier>,
|
||||
paused: &AtomicBool,
|
||||
paused_sync: &Barrier,
|
||||
handler: &mut dyn EpollHelperHandler,
|
||||
) -> std::result::Result<(), EpollHelperError> {
|
||||
self.run_with_timeout(paused, paused_sync, handler, -1, false)
|
||||
@@ -163,8 +163,8 @@ impl EpollHelper {
|
||||
#[cfg(not(fuzzing))]
|
||||
pub fn run_with_timeout(
|
||||
&mut self,
|
||||
paused: Arc<AtomicBool>,
|
||||
paused_sync: Arc<Barrier>,
|
||||
paused: &AtomicBool,
|
||||
paused_sync: &Barrier,
|
||||
handler: &mut dyn EpollHelperHandler,
|
||||
timeout: i32,
|
||||
enable_event_list: bool,
|
||||
@@ -250,8 +250,8 @@ impl EpollHelper {
|
||||
// and return when no epoll events are active
|
||||
pub fn run_with_timeout(
|
||||
&mut self,
|
||||
paused: Arc<AtomicBool>,
|
||||
paused_sync: Arc<Barrier>,
|
||||
paused: &AtomicBool,
|
||||
paused_sync: &Barrier,
|
||||
handler: &mut dyn EpollHelperHandler,
|
||||
_timeout: i32,
|
||||
_enable_event_list: bool,
|
||||
|
||||
Reference in New Issue
Block a user