Fix warnings and errors from beta Rust (#2904)

This commit is contained in:
Benjamin Sparks 2024-09-09 20:55:15 +02:00 committed by GitHub
parent 1ac617a1b5
commit 6efcb75d99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 27 additions and 9 deletions

View File

@ -783,8 +783,9 @@ pub mod close_code {
pub const PROTOCOL: u16 = 1002; pub const PROTOCOL: u16 = 1002;
/// Indicates that an endpoint is terminating the connection because it has received a type of /// 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 /// data that it cannot accept.
/// it receives a binary message). ///
/// For example, an endpoint MAY send this if it understands only text data, but receives a binary message.
pub const UNSUPPORTED: u16 = 1003; pub const UNSUPPORTED: u16 = 1003;
/// Indicates that no status code was included in a closing frame. /// Indicates that no status code was included in a closing frame.
@ -794,12 +795,15 @@ pub mod close_code {
pub const ABNORMAL: u16 = 1006; pub const ABNORMAL: u16 = 1006;
/// Indicates that an endpoint is terminating the connection because it has received data /// 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 /// within a message that was not consistent with the type of the message.
/// RFC3629 data within a text message). ///
/// For example, an endpoint received non-UTF-8 RFC3629 data within a text message.
pub const INVALID: u16 = 1007; pub const INVALID: u16 = 1007;
/// Indicates that an endpoint is terminating the connection because it has received a message /// 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 /// no other more suitable status code (e.g., `UNSUPPORTED` or `SIZE`) or if there is a need to
/// hide specific details about the policy. /// hide specific details about the policy.
pub const POLICY: u16 = 1008; pub const POLICY: u16 = 1008;
@ -808,10 +812,13 @@ pub mod close_code {
/// that is too big for it to process. /// that is too big for it to process.
pub const SIZE: u16 = 1009; pub const SIZE: u16 = 1009;
/// Indicates that an endpoint (client) is terminating the connection because it has expected /// Indicates that an endpoint (client) is terminating the connection because the server
/// the server to negotiate one or more extension, but the server didn't return them in the /// did not respond to extension negotiation correctly.
/// 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, /// 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. /// because it can fail the WebSocket handshake instead.
pub const EXTENSION: u16 = 1010; pub const EXTENSION: u16 = 1010;

View File

@ -328,6 +328,8 @@ where
) -> _, ) -> _,
> = svc.oneshot(req).map(|result| match result { > = svc.oneshot(req).map(|result| match result {
Ok(res) => res.into_response(), Ok(res) => res.into_response(),
#[allow(unreachable_patterns)]
Err(err) => match err {}, Err(err) => match err {},
}); });

View File

@ -341,6 +341,8 @@ impl Next {
pub async fn run(mut self, req: Request) -> Response { pub async fn run(mut self, req: Request) -> Response {
match self.inner.call(req).await { match self.inner.call(req).await {
Ok(res) => res, Ok(res) => res,
#[allow(unreachable_patterns)]
Err(err) => match err {}, Err(err) => match err {},
} }
} }

View File

@ -278,6 +278,8 @@ macro_rules! impl_service {
Ok(res) => { Ok(res) => {
f($($ty,)* res).await.into_response() f($($ty,)* res).await.into_response()
} }
#[allow(unreachable_patterns)]
Err(err) => match err {} Err(err) => match err {}
} }
}); });

View File

@ -236,6 +236,8 @@ impl Future for InfallibleRouteFuture {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match futures_util::ready!(self.project().future.poll(cx)) { match futures_util::ready!(self.project().future.poll(cx)) {
Ok(response) => Poll::Ready(response), Ok(response) => Poll::Ready(response),
#[allow(unreachable_patterns)]
Err(err) => match err {}, Err(err) => match err {},
} }
} }

View File

@ -11,6 +11,8 @@
//! //!
//! [hyper-util]: https://crates.io/crates/hyper-util //! [hyper-util]: https://crates.io/crates/hyper-util
#![allow(unreachable_patterns)]
use std::convert::Infallible; use std::convert::Infallible;
use std::net::SocketAddr; use std::net::SocketAddr;

View File

@ -3,6 +3,7 @@
//! ```not_rust //! ```not_rust
//! cargo run -p example-unix-domain-socket //! cargo run -p example-unix-domain-socket
//! ``` //! ```
#![allow(unreachable_patterns)]
#[cfg(unix)] #[cfg(unix)]
#[tokio::main] #[tokio::main]