mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-07 00:00:12 +02:00
Add #[must_use] to types and methods (#3395)
Co-authored-by: Theodore Bjernhed <[email protected]>
This commit is contained in:
co-authored by
Theodore Bjernhed
parent
d7104313cb
commit
fb64e72de9
@@ -34,6 +34,7 @@ where
|
||||
}
|
||||
|
||||
/// The body type used in axum requests and responses.
|
||||
#[must_use]
|
||||
#[derive(Debug)]
|
||||
pub struct Body(BoxBody);
|
||||
|
||||
@@ -135,6 +136,7 @@ impl http_body::Body for Body {
|
||||
/// A stream of data frames.
|
||||
///
|
||||
/// Created with [`Body::into_data_stream`].
|
||||
#[must_use]
|
||||
#[derive(Debug)]
|
||||
pub struct BodyDataStream {
|
||||
inner: Body,
|
||||
|
||||
@@ -16,6 +16,7 @@ impl Error {
|
||||
}
|
||||
|
||||
/// Convert an `Error` back into the underlying boxed trait object.
|
||||
#[must_use]
|
||||
pub fn into_inner(self) -> BoxError {
|
||||
self.inner
|
||||
}
|
||||
|
||||
@@ -106,11 +106,13 @@ macro_rules! __define_rejection {
|
||||
}
|
||||
|
||||
/// Get the response body text used for this rejection.
|
||||
#[must_use]
|
||||
pub fn body_text(&self) -> String {
|
||||
self.to_string()
|
||||
}
|
||||
|
||||
/// Get the status code used for this rejection.
|
||||
#[must_use]
|
||||
pub fn status(&self) -> http::StatusCode {
|
||||
http::StatusCode::$status
|
||||
}
|
||||
@@ -179,6 +181,7 @@ macro_rules! __composite_rejection {
|
||||
|
||||
impl $name {
|
||||
/// Get the response body text used for this rejection.
|
||||
#[must_use]
|
||||
pub fn body_text(&self) -> String {
|
||||
match self {
|
||||
$(
|
||||
@@ -188,6 +191,7 @@ macro_rules! __composite_rejection {
|
||||
}
|
||||
|
||||
/// Get the status code used for this rejection.
|
||||
#[must_use]
|
||||
pub fn status(&self) -> http::StatusCode {
|
||||
match self {
|
||||
$(
|
||||
|
||||
Reference in New Issue
Block a user