Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): update derive_more to v1.0 #3453

Merged
merged 3 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.72"
rust-version = "1.75"

[profile.dev]
# Disabling debug info speeds up builds a bunch and we don't rely on it for debugging that much.
Expand Down
2 changes: 2 additions & 0 deletions actix-files/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Minimum supported Rust version (MSRV) is now 1.75.

## 0.6.6

- Update `tokio-uring` dependency to `0.4`.
Expand Down
2 changes: 1 addition & 1 deletion actix-files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ actix-web = { version = "4", default-features = false }

bitflags = "2"
bytes = "1"
derive_more = "0.99.5"
derive_more = { version = "1", features = ["display", "error", "from"] }
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
http-range = "0.1.4"
log = "0.4"
Expand Down
14 changes: 7 additions & 7 deletions actix-files/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use actix_web::{http::StatusCode, ResponseError};
use derive_more::Display;
use derive_more::derive::Display;

/// Errors which can occur when serving static files.
#[derive(Debug, PartialEq, Eq, Display)]
pub enum FilesError {
/// Path is not a directory.
#[allow(dead_code)]
#[display(fmt = "path is not a directory. Unable to serve static files")]
#[display("path is not a directory. Unable to serve static files")]
IsNotDirectory,

/// Cannot render directory.
#[display(fmt = "unable to render directory without index file")]
#[display("unable to render directory without index file")]
IsDirectory,
}

Expand All @@ -25,19 +25,19 @@ impl ResponseError for FilesError {
#[non_exhaustive]
pub enum UriSegmentError {
/// Segment started with the wrapped invalid character.
#[display(fmt = "segment started with invalid character: ('{_0}')")]
#[display("segment started with invalid character: ('{_0}')")]
BadStart(char),

/// Segment contained the wrapped invalid character.
#[display(fmt = "segment contained invalid character ('{_0}')")]
#[display("segment contained invalid character ('{_0}')")]
BadChar(char),

/// Segment ended with the wrapped invalid character.
#[display(fmt = "segment ended with invalid character: ('{_0}')")]
#[display("segment ended with invalid character: ('{_0}')")]
BadEnd(char),

/// Path is not a valid UTF-8 string after percent-decoding.
#[display(fmt = "path is not a valid UTF-8 string after percent-decoding")]
#[display("path is not a valid UTF-8 string after percent-decoding")]
NotValidUtf8,
}

Expand Down
2 changes: 1 addition & 1 deletion actix-files/src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use actix_web::{
Error, HttpMessage, HttpRequest, HttpResponse, Responder,
};
use bitflags::bitflags;
use derive_more::{Deref, DerefMut};
use derive_more::derive::{Deref, DerefMut};
use futures_core::future::LocalBoxFuture;
use mime::Mime;

Expand Down
2 changes: 1 addition & 1 deletion actix-files/src/range.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;

use derive_more::Error;
use derive_more::derive::Error;

/// Copy of `http_range::HttpRangeParseError`.
#[derive(Debug, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions actix-http/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Minimum supported Rust version (MSRV) is now 1.75.

## 3.9.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions actix-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ahash = "0.8"
bitflags = "2"
bytes = "1"
bytestring = "1"
derive_more = "0.99.5"
derive_more = { version = "1", features = ["as_ref", "deref", "deref_mut", "display", "error", "from"] }
encoding_rs = "0.8"
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
http = "0.2.7"
Expand Down Expand Up @@ -160,7 +160,7 @@ rcgen = "0.13"
regex = "1.3"
rustversion = "1"
rustls-pemfile = "2"
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
static_assertions = "1"
tls-openssl = { package = "openssl", version = "0.10.55" }
Expand Down
4 changes: 2 additions & 2 deletions actix-http/src/body/body_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod tests {
time::{sleep, Sleep},
};
use actix_utils::future::poll_fn;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use futures_core::ready;
use futures_util::{stream, FutureExt as _};
use pin_project_lite::pin_project;
Expand Down Expand Up @@ -131,7 +131,7 @@ mod tests {
assert_eq!(to_bytes(body).await.ok(), Some(Bytes::from("12")));
}
#[derive(Debug, Display, Error)]
#[display(fmt = "stream error")]
#[display("stream error")]
struct StreamErr;

#[actix_rt::test]
Expand Down
4 changes: 2 additions & 2 deletions actix-http/src/body/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::task::Poll;
use actix_rt::pin;
use actix_utils::future::poll_fn;
use bytes::{Bytes, BytesMut};
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use futures_core::ready;

use super::{BodySize, MessageBody};
Expand Down Expand Up @@ -38,7 +38,7 @@ pub async fn to_bytes<B: MessageBody>(body: B) -> Result<Bytes, B::Error> {

/// Error type returned from [`to_bytes_limited`] when body produced exceeds limit.
#[derive(Debug, Display, Error)]
#[display(fmt = "limit exceeded while collecting body bytes")]
#[display("limit exceeded while collecting body bytes")]
#[non_exhaustive]
pub struct BodyLimitExceeded;

Expand Down
6 changes: 3 additions & 3 deletions actix-http/src/encoding/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{

use actix_rt::task::{spawn_blocking, JoinHandle};
use bytes::Bytes;
use derive_more::Display;
use derive_more::derive::Display;
#[cfg(feature = "compress-gzip")]
use flate2::write::{GzEncoder, ZlibEncoder};
use futures_core::ready;
Expand Down Expand Up @@ -415,11 +415,11 @@ fn new_brotli_compressor() -> Box<brotli::CompressorWriter<Writer>> {
#[non_exhaustive]
pub enum EncoderError {
/// Wrapped body stream error.
#[display(fmt = "body")]
#[display("body")]
Body(Box<dyn StdError>),

/// Generic I/O error.
#[display(fmt = "io")]
#[display("io")]
Io(io::Error),
}

Expand Down
74 changes: 37 additions & 37 deletions actix-http/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::{error::Error as StdError, fmt, io, str::Utf8Error, string::FromUtf8Error};

use derive_more::{Display, Error, From};
use derive_more::derive::{Display, Error, From};
pub use http::{status::InvalidStatusCode, Error as HttpError};
use http::{uri::InvalidUri, StatusCode};

Expand Down Expand Up @@ -80,28 +80,28 @@ impl From<Error> for Response<BoxBody> {

#[derive(Debug, Clone, Copy, PartialEq, Eq, Display)]
pub(crate) enum Kind {
#[display(fmt = "error processing HTTP")]
#[display("error processing HTTP")]
Http,

#[display(fmt = "error parsing HTTP message")]
#[display("error parsing HTTP message")]
Parse,

#[display(fmt = "request payload read error")]
#[display("request payload read error")]
Payload,

#[display(fmt = "response body write error")]
#[display("response body write error")]
Body,

#[display(fmt = "send response error")]
#[display("send response error")]
SendResponse,

#[display(fmt = "error in WebSocket process")]
#[display("error in WebSocket process")]
Ws,

#[display(fmt = "connection error")]
#[display("connection error")]
Io,

#[display(fmt = "encoder error")]
#[display("encoder error")]
Encoder,
}

Expand Down Expand Up @@ -160,44 +160,44 @@ impl From<crate::ws::ProtocolError> for Error {
#[non_exhaustive]
pub enum ParseError {
/// An invalid `Method`, such as `GE.T`.
#[display(fmt = "invalid method specified")]
#[display("invalid method specified")]
Method,

/// An invalid `Uri`, such as `exam ple.domain`.
#[display(fmt = "URI error: {}", _0)]
#[display("URI error: {}", _0)]
Uri(InvalidUri),

/// An invalid `HttpVersion`, such as `HTP/1.1`
#[display(fmt = "invalid HTTP version specified")]
#[display("invalid HTTP version specified")]
Version,

/// An invalid `Header`.
#[display(fmt = "invalid Header provided")]
#[display("invalid Header provided")]
Header,

/// A message head is too large to be reasonable.
#[display(fmt = "message head is too large")]
#[display("message head is too large")]
TooLarge,

/// A message reached EOF, but is not complete.
#[display(fmt = "message is incomplete")]
#[display("message is incomplete")]
Incomplete,

/// An invalid `Status`, such as `1337 ELITE`.
#[display(fmt = "invalid status provided")]
#[display("invalid status provided")]
Status,

/// A timeout occurred waiting for an IO event.
#[allow(dead_code)]
#[display(fmt = "timeout")]
#[display("timeout")]
Timeout,

/// An I/O error that occurred while trying to read or write to a network stream.
#[display(fmt = "I/O error: {}", _0)]
#[display("I/O error: {}", _0)]
Io(io::Error),

/// Parsing a field as string failed.
#[display(fmt = "UTF-8 error: {}", _0)]
#[display("UTF-8 error: {}", _0)]
Utf8(Utf8Error),
}

Expand Down Expand Up @@ -256,28 +256,28 @@ impl From<ParseError> for Response<BoxBody> {
#[non_exhaustive]
pub enum PayloadError {
/// A payload reached EOF, but is not complete.
#[display(fmt = "payload reached EOF before completing: {:?}", _0)]
#[display("payload reached EOF before completing: {:?}", _0)]
Incomplete(Option<io::Error>),

/// Content encoding stream corruption.
#[display(fmt = "can not decode content-encoding")]
#[display("can not decode content-encoding")]
EncodingCorrupted,

/// Payload reached size limit.
#[display(fmt = "payload reached size limit")]
#[display("payload reached size limit")]
Overflow,

/// Payload length is unknown.
#[display(fmt = "payload length is unknown")]
#[display("payload length is unknown")]
UnknownLength,

/// HTTP/2 payload error.
#[cfg(feature = "http2")]
#[display(fmt = "{}", _0)]
#[display("{}", _0)]
Http2Payload(::h2::Error),

/// Generic I/O error.
#[display(fmt = "{}", _0)]
#[display("{}", _0)]
Io(io::Error),
}

Expand Down Expand Up @@ -326,44 +326,44 @@ impl From<PayloadError> for Error {
#[non_exhaustive]
pub enum DispatchError {
/// Service error.
#[display(fmt = "service error")]
#[display("service error")]
Service(Response<BoxBody>),

/// Body streaming error.
#[display(fmt = "body error: {}", _0)]
#[display("body error: {}", _0)]
Body(Box<dyn StdError>),

/// Upgrade service error.
#[display(fmt = "upgrade error")]
#[display("upgrade error")]
Upgrade,

/// An `io::Error` that occurred while trying to read or write to a network stream.
#[display(fmt = "I/O error: {}", _0)]
#[display("I/O error: {}", _0)]
Io(io::Error),

/// Request parse error.
#[display(fmt = "request parse error: {}", _0)]
#[display("request parse error: {}", _0)]
Parse(ParseError),

/// HTTP/2 error.
#[display(fmt = "{}", _0)]
#[display("{}", _0)]
#[cfg(feature = "http2")]
H2(h2::Error),

/// The first request did not complete within the specified timeout.
#[display(fmt = "request did not complete within the specified timeout")]
#[display("request did not complete within the specified timeout")]
SlowRequestTimeout,

/// Disconnect timeout. Makes sense for TLS streams.
#[display(fmt = "connection shutdown timeout")]
#[display("connection shutdown timeout")]
DisconnectTimeout,

/// Handler dropped payload before reading EOF.
#[display(fmt = "handler dropped payload before reading EOF")]
#[display("handler dropped payload before reading EOF")]
HandlerDroppedPayload,

/// Internal error.
#[display(fmt = "internal error")]
#[display("internal error")]
InternalError,
}

Expand All @@ -389,11 +389,11 @@ impl StdError for DispatchError {
#[non_exhaustive]
pub enum ContentTypeError {
/// Can not parse content type.
#[display(fmt = "could not parse content type")]
#[display("could not parse content type")]
ParseError,

/// Unknown content encoding.
#[display(fmt = "unknown content encoding")]
#[display("unknown content encoding")]
UnknownEncoding,
}

Expand Down
4 changes: 2 additions & 2 deletions actix-http/src/header/shared/content_encoding.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use http::header::InvalidHeaderValue;

use crate::{
Expand All @@ -11,7 +11,7 @@ use crate::{

/// Error returned when a content encoding is unknown.
#[derive(Debug, Display, Error)]
#[display(fmt = "unsupported content encoding")]
#[display("unsupported content encoding")]
pub struct ContentEncodingParseError;

/// Represents a supported content encoding.
Expand Down
Loading
Loading