mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Fix new clippy lints (#3304)
This commit is contained in:
@@ -110,7 +110,7 @@ where
|
||||
// so we can call `AsyncRead::lines` and then convert it back to a `Stream`
|
||||
let body = req.into_body();
|
||||
let stream = body.into_data_stream();
|
||||
let stream = stream.map_err(|err| io::Error::new(io::ErrorKind::Other, err));
|
||||
let stream = stream.map_err(io::Error::other);
|
||||
let read = StreamReader::new(stream);
|
||||
let lines_stream = LinesStream::new(read.lines());
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ impl<T: Error + 'static> IntoResponse for InternalServerError<T> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::io::Error;
|
||||
|
||||
#[test]
|
||||
fn internal_server_error() {
|
||||
let response = InternalServerError(Error::new(ErrorKind::Other, "Test")).into_response();
|
||||
let response = InternalServerError(Error::other("Test")).into_response();
|
||||
assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,6 +366,7 @@ mod private {
|
||||
/// This trait is sealed such that it cannot be implemented outside this crate.
|
||||
pub trait IntoMapRequestResult<B>: private::Sealed<B> {
|
||||
/// Perform the conversion.
|
||||
#[allow(clippy::result_large_err)]
|
||||
fn into_map_request_result(self) -> Result<Request<B>, Response>;
|
||||
}
|
||||
|
||||
|
||||
@@ -367,6 +367,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub(super) fn call_with_state(
|
||||
&self,
|
||||
#[cfg_attr(not(feature = "original-uri"), allow(unused_mut))] mut req: Request,
|
||||
|
||||
@@ -120,10 +120,7 @@ impl io::Write for Writer<'_> {
|
||||
vec.extend(buf);
|
||||
Ok(len)
|
||||
}
|
||||
None => Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"inner writer has been taken",
|
||||
)),
|
||||
None => Err(io::Error::other("inner writer has been taken")),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ where
|
||||
|
||||
async {
|
||||
// Convert the stream into an `AsyncRead`.
|
||||
let body_with_io_error = stream.map_err(|err| io::Error::new(io::ErrorKind::Other, err));
|
||||
let body_with_io_error = stream.map_err(io::Error::other);
|
||||
let body_reader = StreamReader::new(body_with_io_error);
|
||||
futures::pin_mut!(body_reader);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user