#[must_use] all the things! (#1809)

This commit is contained in:
David Pedersen
2023-03-03 14:12:35 +01:00
committed by GitHub
parent 5a58edac16
commit 5606ea3f9e
26 changed files with 43 additions and 9 deletions
+1
View File
@@ -46,6 +46,7 @@ pin_project! {
/// ```
#[cfg(feature = "async-read-body")]
#[derive(Debug)]
#[must_use]
pub struct AsyncReadBody<R> {
#[pin]
read: StreamBody<ReaderStream<R>>,
+7
View File
@@ -108,6 +108,7 @@ use tower_service::Service;
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either<E1, E2> {
#[allow(missing_docs)]
E1(E1),
@@ -119,6 +120,7 @@ pub enum Either<E1, E2> {
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either3<E1, E2, E3> {
#[allow(missing_docs)]
E1(E1),
@@ -132,6 +134,7 @@ pub enum Either3<E1, E2, E3> {
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either4<E1, E2, E3, E4> {
#[allow(missing_docs)]
E1(E1),
@@ -147,6 +150,7 @@ pub enum Either4<E1, E2, E3, E4> {
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either5<E1, E2, E3, E4, E5> {
#[allow(missing_docs)]
E1(E1),
@@ -164,6 +168,7 @@ pub enum Either5<E1, E2, E3, E4, E5> {
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either6<E1, E2, E3, E4, E5, E6> {
#[allow(missing_docs)]
E1(E1),
@@ -183,6 +188,7 @@ pub enum Either6<E1, E2, E3, E4, E5, E6> {
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either7<E1, E2, E3, E4, E5, E6, E7> {
#[allow(missing_docs)]
E1(E1),
@@ -204,6 +210,7 @@ pub enum Either7<E1, E2, E3, E4, E5, E6, E7> {
///
/// See the [module docs](self) for examples.
#[derive(Debug, Clone)]
#[must_use]
pub enum Either8<E1, E2, E3, E4, E5, E6, E7, E8> {
#[allow(missing_docs)]
E1(E1),
+1
View File
@@ -58,6 +58,7 @@ pin_project! {
/// ```
// we use `AsExtractor` as the default because you're more likely to name this type if its used
// as an extractor
#[must_use]
pub struct JsonLines<S, T = AsExtractor> {
#[pin]
inner: Inner<S>,
+1
View File
@@ -94,6 +94,7 @@ use std::ops::{Deref, DerefMut};
/// ```
#[derive(Debug, Clone, Copy, Default)]
#[cfg_attr(docsrs, doc(cfg(feature = "protobuf")))]
#[must_use]
pub struct Protobuf<T>(pub T);
#[async_trait]
+1
View File
@@ -30,6 +30,7 @@ use serde::Serialize;
/// ```
#[cfg_attr(docsrs, doc(cfg(feature = "erased-json")))]
#[derive(Debug)]
#[must_use]
pub struct ErasedJson(serde_json::Result<Bytes>);
impl ErasedJson {
+1
View File
@@ -33,6 +33,7 @@ use axum::{
/// # let _: Router = app;
/// ```
#[derive(Debug)]
#[must_use]
pub struct Resource<S = (), B = Body> {
pub(crate) name: String,
pub(crate) router: Router<S, B>,