From 93b01e36ed890556030380cba06a88e5661cfaf0 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Wed, 6 Nov 2019 19:29:17 +0000 Subject: [PATCH] Clippy fixes (#462) --- src/io/buf_read/read_line.rs | 8 ++++++-- src/io/read/read_to_string.rs | 6 +++++- src/sync/mod.rs | 4 +++- src/task/block_on.rs | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/io/buf_read/read_line.rs b/src/io/buf_read/read_line.rs index 29866be0..04c61c1d 100644 --- a/src/io/buf_read/read_line.rs +++ b/src/io/buf_read/read_line.rs @@ -37,8 +37,12 @@ impl Future for ReadLineFuture<'_, T> { )) })) } else { - debug_assert!(buf.is_empty()); - debug_assert_eq!(*read, 0); + #[allow(clippy::debug_assert_with_mut_call)] + { + debug_assert!(buf.is_empty()); + debug_assert_eq!(*read, 0); + } + // Safety: `bytes` is a valid UTF-8 because `str::from_utf8` returned `Ok`. mem::swap(unsafe { buf.as_mut_vec() }, bytes); Poll::Ready(ret) diff --git a/src/io/read/read_to_string.rs b/src/io/read/read_to_string.rs index 60773e07..5f1a4d25 100644 --- a/src/io/read/read_to_string.rs +++ b/src/io/read/read_to_string.rs @@ -37,7 +37,11 @@ impl Future for ReadToStringFuture<'_, T> { )) })) } else { - debug_assert!(buf.is_empty()); + #[allow(clippy::debug_assert_with_mut_call)] + { + debug_assert!(buf.is_empty()); + } + // Safety: `bytes` is a valid UTF-8 because `str::from_utf8` returned `Ok`. mem::swap(unsafe { buf.as_mut_vec() }, bytes); Poll::Ready(ret) diff --git a/src/sync/mod.rs b/src/sync/mod.rs index ea991fe6..56c5f811 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -15,7 +15,7 @@ //! //! Consider the following code, operating on some global static variables: //! -//! ```rust +//! ``` //! static mut A: u32 = 0; //! static mut B: u32 = 0; //! static mut C: u32 = 0; @@ -175,6 +175,8 @@ //! # }) //! ``` +#![allow(clippy::needless_doctest_main)] + #[doc(inline)] pub use std::sync::{Arc, Weak}; diff --git a/src/task/block_on.rs b/src/task/block_on.rs index 54a415f5..d320cb2f 100644 --- a/src/task/block_on.rs +++ b/src/task/block_on.rs @@ -89,6 +89,7 @@ where static VTABLE: RawWakerVTable = { unsafe fn clone_raw(ptr: *const ()) -> RawWaker { let arc = ManuallyDrop::new(Arc::from_raw(ptr as *const Parker)); + #[allow(clippy::redundant_clone)] mem::forget(arc.clone()); RawWaker::new(ptr, &VTABLE) }