Skip to content

Deny warnings on CI #378

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
merged 2 commits into from
Oct 23, 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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
build_and_test:
name: Build and test
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -Dwarnings
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
Expand Down Expand Up @@ -46,6 +48,8 @@ jobs:
check_fmt_and_docs:
name: Checking fmt and docs
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@master

Expand Down Expand Up @@ -77,6 +81,9 @@ jobs:
clippy_check:
name: Clippy check
runs-on: ubuntu-latest
# TODO: There is a lot of warnings
# env:
# RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v1
- id: component
Expand Down
2 changes: 1 addition & 1 deletion src/io/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
}

if this.timeout.poll(cx).is_ready() {
let err = Err(io::Error::new(io::ErrorKind::TimedOut, "future timed out").into());
let err = Err(io::Error::new(io::ErrorKind::TimedOut, "future timed out"));
Poll::Ready(err)
} else {
Poll::Pending
Expand Down
4 changes: 2 additions & 2 deletions src/io/write/write_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ impl<T: Write + Unpin + ?Sized> Future for WriteFmtFuture<'_, T> {
buffer,
..
} = &mut *self;
let mut buffer = buffer.as_mut().unwrap();
let buffer = buffer.as_mut().unwrap();

// Copy the data from the buffer into the writer until it's done.
loop {
if *amt == buffer.len() as u64 {
futures_core::ready!(Pin::new(&mut **writer).poll_flush(cx))?;
return Poll::Ready(Ok(()));
}
let i = futures_core::ready!(Pin::new(&mut **writer).poll_write(cx, &mut buffer))?;
let i = futures_core::ready!(Pin::new(&mut **writer).poll_write(cx, buffer))?;
if i == 0 {
return Poll::Ready(Err(io::ErrorKind::WriteZero.into()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl ToSocketAddrs for str {
impl Future<Output = Self::Iter>,
ToSocketAddrsFuture<Self::Iter>
) {
if let Some(addr) = self.parse().ok() {
if let Ok(addr) = self.parse() {
return ToSocketAddrsFuture::Ready(Ok(vec![addr].into_iter()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/path/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ impl AsRef<Path> for String {

impl AsRef<Path> for std::path::PathBuf {
fn as_ref(&self) -> &Path {
Path::new(self.into())
Path::new(self)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/path/pathbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::path::Path;
/// This struct is an async version of [`std::path::PathBuf`].
///
/// [`std::path::Path`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Default)]
pub struct PathBuf {
inner: std::path::PathBuf,
}
Expand Down Expand Up @@ -206,7 +206,7 @@ impl From<std::path::PathBuf> for PathBuf {

impl Into<std::path::PathBuf> for PathBuf {
fn into(self) -> std::path::PathBuf {
self.inner.into()
self.inner
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/stream/exact_size_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub use crate::stream::Stream;
/// # }
/// # }
/// # }
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// impl ExactSizeStream for Counter {
/// // We can easily calculate the remaining number of iterations.
Expand All @@ -74,7 +74,6 @@ pub use crate::stream::Stream;
///
/// assert_eq!(5, counter.len());
/// # });
/// # }
/// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
Expand Down
4 changes: 2 additions & 2 deletions src/stream/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::stream::IntoStream;
/// ## Examples
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::prelude::*;
/// use async_std::stream::{self, Extend};
Expand All @@ -25,7 +25,7 @@ use crate::stream::IntoStream;
///
/// assert_eq!(v, vec![1, 2, 3, 3, 3]);
/// #
/// # }) }
/// # })
/// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
Expand Down
5 changes: 2 additions & 3 deletions src/stream/from_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pin_project! {
/// # Examples
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::prelude::*;
/// use async_std::sync::Mutex;
Expand Down Expand Up @@ -58,8 +58,7 @@ pin_project! {
/// assert_eq!(s.next().await, Some(3));
/// assert_eq!(s.next().await, None);
/// #
/// # }) }
///
/// # })
/// ```
pub fn from_fn<T, F, Fut>(f: F) -> FromFn<F, Fut, T>
where
Expand Down
8 changes: 4 additions & 4 deletions src/stream/repeat_with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pin_project! {
/// Basic usage:
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::prelude::*;
/// use async_std::stream;
Expand All @@ -42,13 +42,13 @@ pin_project! {
/// assert_eq!(s.next().await, Some(1));
/// assert_eq!(s.next().await, Some(1));
/// assert_eq!(s.next().await, Some(1));
/// # }) }
/// # })
/// ```
///
/// Going finite:
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::prelude::*;
/// use async_std::stream;
Expand All @@ -60,7 +60,7 @@ pin_project! {
/// assert_eq!(s.next().await, Some(1));
/// assert_eq!(s.next().await, Some(1));
/// assert_eq!(s.next().await, None);
/// # }) }
/// # })
/// ```
pub fn repeat_with<F, Fut, A>(repeater: F) -> RepeatWith<F, Fut, A>
where
Expand Down
9 changes: 3 additions & 6 deletions src/sync/barrier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::sync::Mutex;
/// # Examples
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::sync::{Arc, Barrier};
/// use async_std::task;
Expand All @@ -30,7 +30,6 @@ use crate::sync::Mutex;
/// handle.await;
/// }
/// # });
/// # }
/// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
Expand Down Expand Up @@ -120,7 +119,7 @@ impl Barrier {
/// # Examples
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::sync::{Arc, Barrier};
/// use async_std::task;
Expand All @@ -142,7 +141,6 @@ impl Barrier {
/// handle.await;
/// }
/// # });
/// # }
/// ```
pub async fn wait(&self) -> BarrierWaitResult {
let mut lock = self.state.lock().await;
Expand Down Expand Up @@ -190,15 +188,14 @@ impl BarrierWaitResult {
/// # Examples
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::sync::Barrier;
///
/// let barrier = Barrier::new(1);
/// let barrier_wait_result = barrier.wait().await;
/// println!("{:?}", barrier_wait_result.is_leader());
/// # });
/// # }
/// ```
pub fn is_leader(&self) -> bool {
self.0
Expand Down
4 changes: 2 additions & 2 deletions src/task/yield_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ use std::pin::Pin;
/// Basic usage:
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// # async_std::task::block_on(async {
/// #
/// use async_std::task;
///
/// task::yield_now().await;
/// #
/// # }) }
/// # })
/// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
Expand Down