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
@@ -76,6 +76,7 @@ const HTTP_ROOT: &str = "/api/v1";
|
||||
/// The error message contained in the response is supposed to be user-facing,
|
||||
/// thus insightful and helpful while balancing technical accuracy and
|
||||
/// simplicity.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn error_response(error: HttpError, status: StatusCode) -> Response {
|
||||
let mut response = Response::new(Version::Http11, status);
|
||||
|
||||
|
||||
@@ -369,6 +369,7 @@ pub trait RequestHandler {
|
||||
pub type ApiRequest =
|
||||
Box<dyn FnOnce(&mut dyn RequestHandler) -> Result<bool, VmmError> + Send + 'static>;
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
fn get_response<Action: ApiAction>(
|
||||
action: &Action,
|
||||
api_evt: EventFd,
|
||||
|
||||
Reference in New Issue
Block a user