#[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
+4 -2
View File
@@ -9,11 +9,13 @@ and this project adheres to [Semantic Versioning].
- **added:** Add `Multipart`. This is similar to `axum::extract::Multipart`
except that it enforces field exclusivity at runtime instead of compile time,
as this improves usability.
as this improves usability ([#1692])
- **added:** Implement `Clone` for `CookieJar`, `PrivateCookieJar` and `SignedCookieJar` ([#1808])
- **fixed:** Add `#[must_use]` attributes to types that do nothing unless used ([#1809])
[#1692]: https://github.com/tokio-rs/axum/pull/1692
[#1808]: https://github.com/tokio-rs/axum/pull/1808
[#1809]: https://github.com/tokio-rs/axum/pull/1809
# 0.6.0 (24. February, 2022)
+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>,