mirror of
https://github.com/async-rs/async-std.git
synced 2025-01-16 10:49:55 +00:00
Clippy fixes (#462)
This commit is contained in:
parent
d502453057
commit
93b01e36ed
4 changed files with 15 additions and 4 deletions
|
@ -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…
Reference in a new issue