Skip to content
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

Fix warnings and errors from beta Rust #2904

Merged
merged 4 commits into from
Sep 9, 2024
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
25 changes: 16 additions & 9 deletions axum/src/extract/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,9 @@ pub mod close_code {
pub const PROTOCOL: u16 = 1002;

/// Indicates that an endpoint is terminating the connection because it has received a type of
/// data it cannot accept (e.g., an endpoint that understands only text data MAY send this if
/// it receives a binary message).
/// data that it cannot accept.
///
/// For example, an endpoint MAY send this if it understands only text data, but receives a binary message.
pub const UNSUPPORTED: u16 = 1003;

/// Indicates that no status code was included in a closing frame.
Expand All @@ -794,12 +795,15 @@ pub mod close_code {
pub const ABNORMAL: u16 = 1006;

/// Indicates that an endpoint is terminating the connection because it has received data
/// within a message that was not consistent with the type of the message (e.g., non-UTF-8
/// RFC3629 data within a text message).
/// within a message that was not consistent with the type of the message.
///
/// For example, an endpoint received non-UTF-8 RFC3629 data within a text message.
pub const INVALID: u16 = 1007;

/// Indicates that an endpoint is terminating the connection because it has received a message
/// that violates its policy. This is a generic status code that can be returned when there is
/// that violates its policy.
///
/// This is a generic status code that can be returned when there is
/// no other more suitable status code (e.g., `UNSUPPORTED` or `SIZE`) or if there is a need to
/// hide specific details about the policy.
pub const POLICY: u16 = 1008;
Expand All @@ -808,10 +812,13 @@ pub mod close_code {
/// that is too big for it to process.
pub const SIZE: u16 = 1009;

/// Indicates that an endpoint (client) is terminating the connection because it has expected
/// the server to negotiate one or more extension, but the server didn't return them in the
/// response message of the WebSocket handshake. The list of extensions that are needed should
/// be given as the reason for closing. Note that this status code is not used by the server,
/// Indicates that an endpoint (client) is terminating the connection because the server
/// did not respond to extension negotiation correctly.
///
/// Specifically, the client has expected the server to negotiate one or more extension(s),
/// but the server didn't return them in the response message of the WebSocket handshake.
/// The list of extensions that are needed should be given as the reason for closing.
/// Note that this status code is not used by the server,
/// because it can fail the WebSocket handshake instead.
pub const EXTENSION: u16 = 1010;

Expand Down
2 changes: 2 additions & 0 deletions axum/src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ where
) -> _,
> = svc.oneshot(req).map(|result| match result {
Ok(res) => res.into_response(),

#[allow(unreachable_patterns)]
Err(err) => match err {},
});

Expand Down
2 changes: 2 additions & 0 deletions axum/src/middleware/from_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ impl Next {
pub async fn run(mut self, req: Request) -> Response {
match self.inner.call(req).await {
Ok(res) => res,

#[allow(unreachable_patterns)]
Err(err) => match err {},
}
}
Expand Down
2 changes: 2 additions & 0 deletions axum/src/middleware/map_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ macro_rules! impl_service {
Ok(res) => {
f($($ty,)* res).await.into_response()
}

#[allow(unreachable_patterns)]
Err(err) => match err {}
}
});
Expand Down
2 changes: 2 additions & 0 deletions axum/src/routing/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ impl Future for InfallibleRouteFuture {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match futures_util::ready!(self.project().future.poll(cx)) {
Ok(response) => Poll::Ready(response),

#[allow(unreachable_patterns)]
Err(err) => match err {},
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/serve-with-hyper/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
//!
//! [hyper-util]: https://crates.io/crates/hyper-util

#![allow(unreachable_patterns)]

use std::convert::Infallible;
use std::net::SocketAddr;

Expand Down
1 change: 1 addition & 0 deletions examples/unix-domain-socket/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! ```not_rust
//! cargo run -p example-unix-domain-socket
//! ```
#![allow(unreachable_patterns)]

#[cfg(unix)]
#[tokio::main]
Expand Down