Add #[must_use] to types and methods (#3395)

Co-authored-by: Theodore Bjernhed <[email protected]>
This commit is contained in:
Theodore Bjernhed
2025-07-05 19:07:24 +02:00
committed by GitHub
co-authored by Theodore Bjernhed
parent d7104313cb
commit fb64e72de9
22 changed files with 59 additions and 6 deletions
+2
View File
@@ -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,
+1
View File
@@ -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
}
+4
View File
@@ -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 {
$(