Skip to content

Commit

Permalink
silence warnings reported by newer rust versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Keruspe committed Aug 21, 2024
1 parent 19ccd34 commit 8074a10
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 17 deletions.
1 change: 1 addition & 0 deletions examples/a-chat/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async fn connection_writer_loop(
None => break,
},
void = shutdown.next().fuse() => match void {
#[allow(unreachable_patterns)]
Some(void) => match void {},
None => break,
}
Expand Down
2 changes: 2 additions & 0 deletions src/future/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub use core::future::Future as Future;
[`Future`]: ../future/trait.Future.html
"#]
#[cfg(any(feature = "std", feature = "docs"))]
pub trait FutureExt: Future {
/// Returns a Future that delays execution for a specified time.
///
Expand Down Expand Up @@ -284,5 +285,6 @@ pub trait FutureExt: Future {
}
}

#[cfg(any(feature = "std", feature = "docs"))]
impl<T: Future + ?Sized> FutureExt for T {}

2 changes: 1 addition & 1 deletion src/io/buf_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pin_project! {
/// # Ok(()) }) }
///```
#[derive(Debug)]
pub struct IntoInnerError<W>(W, crate::io::Error);
pub struct IntoInnerError<W>(W, #[allow(dead_code)] crate::io::Error);

impl<W: Write> BufWriter<W> {
/// Creates a new `BufWriter` with a default buffer capacity. The default is currently 8 KB,
Expand Down
2 changes: 1 addition & 1 deletion src/io/read/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<T: Read + Unpin> Stream for Bytes<T> {
}
}

#[cfg(all(test, default))]
#[cfg(all(test, feature = "default"))]
mod tests {
use crate::io;
use crate::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/io/read/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
}
}

#[cfg(all(test, default))]
#[cfg(all(test, feature = "default"))]
mod tests {
use crate::io;
use crate::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/io/stderr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ cfg_windows! {
}

cfg_io_safety! {
use crate::os::unix::io::{AsHandle, BorrowedHandle};
use crate::os::windows::io::{AsHandle, BorrowedHandle};

impl AsHandle for Stderr {
fn as_handle(&self) -> BorrowedHandle<'_> {
Expand Down
8 changes: 4 additions & 4 deletions src/io/stdin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ cfg_windows! {
}

cfg_io_safety! {
use crate::os::unix::io::{AsFd, BorrowedFd};
use crate::os::windows::io::{AsHandle, BorrowedHandle};

impl AsFd for Stdin {
fn as_fd(&self) -> BorrowedFd<'_> {
std::io::stdin().as_fd()
impl AsHandle for Stdin {
fn as_handle(&self) -> BorrowedHandle<'_> {
std::io::stdin().as_handle()

Check failure on line 237 in src/io/stdin.rs

View workflow job for this annotation

GitHub Actions / Check io_safety feature (windows-latest)

cannot return value referencing temporary value
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/stdout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ cfg_windows! {
}

cfg_io_safety! {
use crate::os::unix::io::{AsHandle, BorrowedHandle};
use crate::os::windows::io::{AsHandle, BorrowedHandle};

impl AsHandle for Stdout {
fn as_handle(&self) -> BorrowedHandle<'_> {
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@
#![doc(test(attr(allow(unused_extern_crates, unused_variables))))]
#![doc(html_logo_url = "https://async.rs/images/logo--hero.svg")]

extern crate alloc;

#[macro_use]
mod utils;

Expand Down
2 changes: 1 addition & 1 deletion src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//! ```
//! # use async_std::task::{Context, Poll};
//! # use std::pin::Pin;
//! trait Stream {
//! pub trait Stream {
//! type Item;

Check failure on line 40 in src/stream/mod.rs

View workflow job for this annotation

GitHub Actions / Build and test (macOS-latest, beta)

trait `Stream` is never used

Check failure on line 40 in src/stream/mod.rs

View workflow job for this annotation

GitHub Actions / Build and test (macOS-latest, stable)

trait `Stream` is never used
//! fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>;
//! }
Expand Down
7 changes: 2 additions & 5 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use alloc::string::String;

/// Calls a function and aborts if it panics.
///
/// This is useful in unsafe code where we can't recover from panics.
Expand Down Expand Up @@ -55,6 +53,7 @@ pub fn random(n: u32) -> u32 {
}

/// Add additional context to errors
#[cfg(feature = "std")]
pub(crate) trait Context {
fn context(self, message: impl Fn() -> String) -> Self;
}
Expand Down Expand Up @@ -148,7 +147,7 @@ macro_rules! cfg_unstable_default {
($($item:item)*) => {
$(
#[cfg(all(feature = "default", feature = "unstable"))]
#[cfg_attr(feature = "docs", doc(unstable))]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
$item
)*
}
Expand All @@ -161,7 +160,6 @@ macro_rules! cfg_unix {
($($item:item)*) => {
$(
#[cfg(any(unix, feature = "docs"))]
#[cfg_attr(feature = "docs", doc(cfg(unix)))]
$item
)*
}
Expand All @@ -174,7 +172,6 @@ macro_rules! cfg_windows {
($($item:item)*) => {
$(
#[cfg(any(windows, feature = "docs"))]
#[cfg_attr(feature = "docs", doc(cfg(windows)))]
$item
)*
}
Expand Down

0 comments on commit 8074a10

Please sign in to comment.