Clippy fixes (#462)

pull/475/head
Stjepan Glavina 5 years ago committed by GitHub
parent d502453057
commit 93b01e36ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,8 +37,12 @@ impl<T: BufRead + Unpin + ?Sized> 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)

@ -37,7 +37,11 @@ impl<T: Read + Unpin + ?Sized> 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)

@ -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};

@ -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)
}

Loading…
Cancel
Save