From 01d91a16f90c4a9a011a3c1db3d6330667f7c938 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Fri, 8 Nov 2019 00:49:32 +0100 Subject: [PATCH] Fix clippy errors --- bastion-executor/src/lib.rs | 2 ++ lightproc/src/layout_helpers.rs | 7 ++----- lightproc/src/lib.rs | 3 +++ lightproc/src/state.rs | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bastion-executor/src/lib.rs b/bastion-executor/src/lib.rs index ba9876f9..25034372 100644 --- a/bastion-executor/src/lib.rs +++ b/bastion-executor/src/lib.rs @@ -5,6 +5,8 @@ //! //! +// Discarded lints +#![allow(clippy::if_same_then_else)] // Force missing implementations #![warn(missing_docs)] #![warn(missing_debug_implementations)] diff --git a/lightproc/src/layout_helpers.rs b/lightproc/src/layout_helpers.rs index feb29761..2af15db1 100644 --- a/lightproc/src/layout_helpers.rs +++ b/lightproc/src/layout_helpers.rs @@ -9,14 +9,11 @@ pub(crate) fn extend(layout: Layout, next: Layout) -> (Layout, usize) { let offset = layout .size() .checked_add(pad) - .ok_or(Error::new( - ErrorKind::Other, - "Padding overflow check failed", - )) + .ok_or_else(|| Error::new(ErrorKind::Other, "Padding overflow check failed")) .unwrap(); let new_size = offset .checked_add(next.size()) - .ok_or(Error::new(ErrorKind::Other, "New size can't be computed")) + .ok_or_else(|| Error::new(ErrorKind::Other, "New size can't be computed")) .unwrap(); let layout = Layout::from_size_align(new_size, new_align).unwrap(); diff --git a/lightproc/src/lib.rs b/lightproc/src/lib.rs index 46d3d493..39208f9a 100644 --- a/lightproc/src/lib.rs +++ b/lightproc/src/lib.rs @@ -1,3 +1,6 @@ +// Discarded lints +#![allow(clippy::cast_ptr_alignment)] + mod catch_unwind; mod layout_helpers; mod proc_data; diff --git a/lightproc/src/state.rs b/lightproc/src/state.rs index a09e11d1..c14d6562 100644 --- a/lightproc/src/state.rs +++ b/lightproc/src/state.rs @@ -6,7 +6,7 @@ /// /// This flag can't be set when the proc is completed. However, it can be set while the proc is /// running, in which case it will be rescheduled as soon as polling finishes. -pub(crate) const SCHEDULED: usize = 1 << 0; +pub(crate) const SCHEDULED: usize = 1; /// Set if the proc is running. ///