Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2abf5ca

Browse files
authored
Deny warnings on CI (#378)
* Deny warnings on CI * Fix some clippy warnings
1 parent 944e43d commit 2abf5ca

File tree

12 files changed

+28
-26
lines changed

12 files changed

+28
-26
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
build_and_test:
1212
name: Build and test
1313
runs-on: ${{ matrix.os }}
14+
env:
15+
RUSTFLAGS: -Dwarnings
1416
strategy:
1517
matrix:
1618
os: [ubuntu-latest, windows-latest, macOS-latest]
@@ -46,6 +48,8 @@ jobs:
4648
check_fmt_and_docs:
4749
name: Checking fmt and docs
4850
runs-on: ubuntu-latest
51+
env:
52+
RUSTFLAGS: -Dwarnings
4953
steps:
5054
- uses: actions/checkout@master
5155

@@ -77,6 +81,9 @@ jobs:
7781
clippy_check:
7882
name: Clippy check
7983
runs-on: ubuntu-latest
84+
# TODO: There is a lot of warnings
85+
# env:
86+
# RUSTFLAGS: -Dwarnings
8087
steps:
8188
- uses: actions/checkout@v1
8289
- id: component

‎src/io/timeout.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171
}
7272

7373
if this.timeout.poll(cx).is_ready() {
74-
let err = Err(io::Error::new(io::ErrorKind::TimedOut, "future timed out").into());
74+
let err = Err(io::Error::new(io::ErrorKind::TimedOut, "future timed out"));
7575
Poll::Ready(err)
7676
} else {
7777
Poll::Pending

‎src/io/write/write_fmt.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ impl<T: Write + Unpin + ?Sized> Future for WriteFmtFuture<'_, T> {
3232
buffer,
3333
..
3434
} = &mut *self;
35-
let mutbuffer = buffer.as_mut().unwrap();
35+
let buffer = buffer.as_mut().unwrap();
3636

3737
// Copy the data from the buffer into the writer until it's done.
3838
loop {
3939
if *amt == buffer.len() as u64 {
4040
futures_core::ready!(Pin::new(&mut **writer).poll_flush(cx))?;
4141
return Poll::Ready(Ok(()));
4242
}
43-
let i = futures_core::ready!(Pin::new(&mut **writer).poll_write(cx, &mutbuffer))?;
43+
let i = futures_core::ready!(Pin::new(&mut **writer).poll_write(cx, buffer))?;
4444
if i == 0 {
4545
return Poll::Ready(Err(io::ErrorKind::WriteZero.into()));
4646
}

‎src/net/addr.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl ToSocketAddrs for str {
210210
impl Future<Output = Self::Iter>,
211211
ToSocketAddrsFuture<Self::Iter>
212212
) {
213-
if let Some(addr) = self.parse().ok() {
213+
if let Ok(addr) = self.parse() {
214214
return ToSocketAddrsFuture::Ready(Ok(vec![addr].into_iter()));
215215
}
216216

‎src/path/path.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ impl AsRef<Path> for String {
799799

800800
impl AsRef<Path> for std::path::PathBuf {
801801
fn as_ref(&self) -> &Path {
802-
Path::new(self.into())
802+
Path::new(self)
803803
}
804804
}
805805

‎src/path/pathbuf.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::path::Path;
55
/// This struct is an async version of [`std::path::PathBuf`].
66
///
77
/// [`std::path::Path`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html
8-
#[derive(Debug, PartialEq)]
8+
#[derive(Debug, PartialEq,Default)]
99
pub struct PathBuf {
1010
inner: std::path::PathBuf,
1111
}
@@ -206,7 +206,7 @@ impl From<std::path::PathBuf> for PathBuf {
206206

207207
impl Into<std::path::PathBuf> for PathBuf {
208208
fn into(self) -> std::path::PathBuf {
209-
self.inner.into()
209+
self.inner
210210
}
211211
}
212212

‎src/stream/exact_size_stream.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub use crate::stream::Stream;
5959
/// # }
6060
/// # }
6161
/// # }
62-
/// # fn main() { async_std::task::block_on(async {
62+
/// # async_std::task::block_on(async {
6363
/// #
6464
/// impl ExactSizeStream for Counter {
6565
/// // We can easily calculate the remaining number of iterations.
@@ -74,7 +74,6 @@ pub use crate::stream::Stream;
7474
///
7575
/// assert_eq!(5, counter.len());
7676
/// # });
77-
/// # }
7877
/// ```
7978
#[cfg(feature = "unstable")]
8079
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]

‎src/stream/extend.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::stream::IntoStream;
1414
/// ## Examples
1515
///
1616
/// ```
17-
/// # fn main() { async_std::task::block_on(async {
17+
/// # async_std::task::block_on(async {
1818
/// #
1919
/// use async_std::prelude::*;
2020
/// use async_std::stream::{self, Extend};
@@ -25,7 +25,7 @@ use crate::stream::IntoStream;
2525
///
2626
/// assert_eq!(v, vec![1, 2, 3, 3, 3]);
2727
/// #
28-
/// # }) }
28+
/// # })
2929
/// ```
3030
#[cfg(feature = "unstable")]
3131
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]

‎src/stream/from_fn.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pin_project! {
3030
/// # Examples
3131
///
3232
/// ```
33-
/// # fn main() { async_std::task::block_on(async {
33+
/// # async_std::task::block_on(async {
3434
/// #
3535
/// use async_std::prelude::*;
3636
/// use async_std::sync::Mutex;
@@ -58,8 +58,7 @@ pin_project! {
5858
/// assert_eq!(s.next().await, Some(3));
5959
/// assert_eq!(s.next().await, None);
6060
/// #
61-
/// # }) }
62-
///
61+
/// # })
6362
/// ```
6463
pub fn from_fn<T, F, Fut>(f: F) -> FromFn<F, Fut, T>
6564
where

‎src/stream/repeat_with.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pin_project! {
2929
/// Basic usage:
3030
///
3131
/// ```
32-
/// # fn main() { async_std::task::block_on(async {
32+
/// # async_std::task::block_on(async {
3333
/// #
3434
/// use async_std::prelude::*;
3535
/// use async_std::stream;
@@ -42,13 +42,13 @@ pin_project! {
4242
/// assert_eq!(s.next().await, Some(1));
4343
/// assert_eq!(s.next().await, Some(1));
4444
/// assert_eq!(s.next().await, Some(1));
45-
/// # }) }
45+
/// # })
4646
/// ```
4747
///
4848
/// Going finite:
4949
///
5050
/// ```
51-
/// # fn main() { async_std::task::block_on(async {
51+
/// # async_std::task::block_on(async {
5252
/// #
5353
/// use async_std::prelude::*;
5454
/// use async_std::stream;
@@ -60,7 +60,7 @@ pin_project! {
6060
/// assert_eq!(s.next().await, Some(1));
6161
/// assert_eq!(s.next().await, Some(1));
6262
/// assert_eq!(s.next().await, None);
63-
/// # }) }
63+
/// # })
6464
/// ```
6565
pub fn repeat_with<F, Fut, A>(repeater: F) -> RepeatWith<F, Fut, A>
6666
where

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /