Skip to content

Clippy fixes #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/io/buf_read/read_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/io/read/read_to_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -175,6 +175,8 @@
//! # })
//! ```

#![allow(clippy::needless_doctest_main)]

#[doc(inline)]
pub use std::sync::{Arc, Weak};

Expand Down
1 change: 1 addition & 0 deletions src/task/block_on.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down