mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-27 07:19:04 +02:00
build(deps): update derive_more to v1.0 (#3453)
* build(deps): update derive_more to v1.0 * refactor: use from derive module --------- Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||
|
||||
## 4.9.0
|
||||
|
||||
### Added
|
||||
|
@ -146,7 +146,7 @@ bytes = "1"
|
||||
bytestring = "1"
|
||||
cfg-if = "1"
|
||||
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
||||
derive_more = "0.99.8"
|
||||
derive_more = { version = "1", features = ["display", "error", "from"] }
|
||||
encoding_rs = "0.8"
|
||||
futures-core = { version = "0.3.17", default-features = false }
|
||||
futures-util = { version = "0.3.17", default-features = false }
|
||||
@ -182,7 +182,7 @@ futures-util = { version = "0.3.17", default-features = false, features = ["std"
|
||||
rand = "0.8"
|
||||
rcgen = "0.13"
|
||||
rustls-pemfile = "2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
static_assertions = "1"
|
||||
tls-openssl = { package = "openssl", version = "0.10.55" }
|
||||
tls-rustls = { package = "rustls", version = "0.23" }
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// See <https://github.com/rust-lang/rust/issues/83375>
|
||||
pub use actix_http::error::{ContentTypeError, DispatchError, HttpError, ParseError, PayloadError};
|
||||
use derive_more::{Display, Error, From};
|
||||
use derive_more::derive::{Display, Error, From};
|
||||
use serde_json::error::Error as JsonError;
|
||||
use serde_urlencoded::{de::Error as FormDeError, ser::Error as FormError};
|
||||
use url::ParseError as UrlParseError;
|
||||
@ -29,7 +29,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
||||
/// An error representing a problem running a blocking task on a thread pool.
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Blocking thread pool is shut down unexpectedly")]
|
||||
#[display("Blocking thread pool is shut down unexpectedly")]
|
||||
#[non_exhaustive]
|
||||
pub struct BlockingError;
|
||||
|
||||
@ -40,15 +40,15 @@ impl ResponseError for crate::error::BlockingError {}
|
||||
#[non_exhaustive]
|
||||
pub enum UrlGenerationError {
|
||||
/// Resource not found.
|
||||
#[display(fmt = "Resource not found")]
|
||||
#[display("Resource not found")]
|
||||
ResourceNotFound,
|
||||
|
||||
/// Not all URL parameters covered.
|
||||
#[display(fmt = "Not all URL parameters covered")]
|
||||
#[display("Not all URL parameters covered")]
|
||||
NotEnoughElements,
|
||||
|
||||
/// URL parse error.
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
ParseError(UrlParseError),
|
||||
}
|
||||
|
||||
@ -59,39 +59,39 @@ impl ResponseError for UrlGenerationError {}
|
||||
#[non_exhaustive]
|
||||
pub enum UrlencodedError {
|
||||
/// Can not decode chunked transfer encoding.
|
||||
#[display(fmt = "Can not decode chunked transfer encoding.")]
|
||||
#[display("Can not decode chunked transfer encoding.")]
|
||||
Chunked,
|
||||
|
||||
/// Payload size is larger than allowed. (default limit: 256kB).
|
||||
#[display(
|
||||
fmt = "URL encoded payload is larger ({} bytes) than allowed (limit: {} bytes).",
|
||||
"URL encoded payload is larger ({} bytes) than allowed (limit: {} bytes).",
|
||||
size,
|
||||
limit
|
||||
)]
|
||||
Overflow { size: usize, limit: usize },
|
||||
|
||||
/// Payload size is now known.
|
||||
#[display(fmt = "Payload size is now known.")]
|
||||
#[display("Payload size is now known.")]
|
||||
UnknownLength,
|
||||
|
||||
/// Content type error.
|
||||
#[display(fmt = "Content type error.")]
|
||||
#[display("Content type error.")]
|
||||
ContentType,
|
||||
|
||||
/// Parse error.
|
||||
#[display(fmt = "Parse error: {}.", _0)]
|
||||
#[display("Parse error: {}.", _0)]
|
||||
Parse(FormDeError),
|
||||
|
||||
/// Encoding error.
|
||||
#[display(fmt = "Encoding error.")]
|
||||
#[display("Encoding error.")]
|
||||
Encoding,
|
||||
|
||||
/// Serialize error.
|
||||
#[display(fmt = "Serialize error: {}.", _0)]
|
||||
#[display("Serialize error: {}.", _0)]
|
||||
Serialize(FormError),
|
||||
|
||||
/// Payload error.
|
||||
#[display(fmt = "Error that occur during reading payload: {}.", _0)]
|
||||
#[display("Error that occur during reading payload: {}.", _0)]
|
||||
Payload(PayloadError),
|
||||
}
|
||||
|
||||
@ -113,30 +113,30 @@ impl ResponseError for UrlencodedError {
|
||||
pub enum JsonPayloadError {
|
||||
/// Payload size is bigger than allowed & content length header set. (default: 2MB)
|
||||
#[display(
|
||||
fmt = "JSON payload ({} bytes) is larger than allowed (limit: {} bytes).",
|
||||
"JSON payload ({} bytes) is larger than allowed (limit: {} bytes).",
|
||||
length,
|
||||
limit
|
||||
)]
|
||||
OverflowKnownLength { length: usize, limit: usize },
|
||||
|
||||
/// Payload size is bigger than allowed but no content length header set. (default: 2MB)
|
||||
#[display(fmt = "JSON payload has exceeded limit ({} bytes).", limit)]
|
||||
#[display("JSON payload has exceeded limit ({} bytes).", limit)]
|
||||
Overflow { limit: usize },
|
||||
|
||||
/// Content type error
|
||||
#[display(fmt = "Content type error")]
|
||||
#[display("Content type error")]
|
||||
ContentType,
|
||||
|
||||
/// Deserialize error
|
||||
#[display(fmt = "Json deserialize error: {}", _0)]
|
||||
#[display("Json deserialize error: {}", _0)]
|
||||
Deserialize(JsonError),
|
||||
|
||||
/// Serialize error
|
||||
#[display(fmt = "Json serialize error: {}", _0)]
|
||||
#[display("Json serialize error: {}", _0)]
|
||||
Serialize(JsonError),
|
||||
|
||||
/// Payload error
|
||||
#[display(fmt = "Error that occur during reading payload: {}", _0)]
|
||||
#[display("Error that occur during reading payload: {}", _0)]
|
||||
Payload(PayloadError),
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ impl ResponseError for JsonPayloadError {
|
||||
#[non_exhaustive]
|
||||
pub enum PathError {
|
||||
/// Deserialize error
|
||||
#[display(fmt = "Path deserialize error: {}", _0)]
|
||||
#[display("Path deserialize error: {}", _0)]
|
||||
Deserialize(serde::de::value::Error),
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ impl ResponseError for PathError {
|
||||
#[non_exhaustive]
|
||||
pub enum QueryPayloadError {
|
||||
/// Query deserialize error.
|
||||
#[display(fmt = "Query deserialize error: {}", _0)]
|
||||
#[display("Query deserialize error: {}", _0)]
|
||||
Deserialize(serde::de::value::Error),
|
||||
}
|
||||
|
||||
@ -196,20 +196,20 @@ impl ResponseError for QueryPayloadError {
|
||||
#[derive(Debug, Display, Error, From)]
|
||||
#[non_exhaustive]
|
||||
pub enum ReadlinesError {
|
||||
#[display(fmt = "Encoding error")]
|
||||
#[display("Encoding error")]
|
||||
/// Payload size is bigger than allowed. (default: 256kB)
|
||||
EncodingError,
|
||||
|
||||
/// Payload error.
|
||||
#[display(fmt = "Error that occur during reading payload: {}", _0)]
|
||||
#[display("Error that occur during reading payload: {}", _0)]
|
||||
Payload(PayloadError),
|
||||
|
||||
/// Line limit exceeded.
|
||||
#[display(fmt = "Line limit exceeded")]
|
||||
#[display("Line limit exceeded")]
|
||||
LimitOverflow,
|
||||
|
||||
/// ContentType error.
|
||||
#[display(fmt = "Content-type error")]
|
||||
#[display("Content-type error")]
|
||||
ContentTypeError(ContentTypeError),
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{convert::Infallible, str};
|
||||
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use derive_more::derive::{Deref, DerefMut};
|
||||
|
||||
use crate::{
|
||||
error::ParseError,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::{convert::Infallible, net::SocketAddr};
|
||||
|
||||
use actix_utils::future::{err, ok, Ready};
|
||||
use derive_more::{Display, Error};
|
||||
use derive_more::derive::{Display, Error};
|
||||
|
||||
use crate::{
|
||||
dev::{AppConfig, Payload, RequestHead},
|
||||
@ -235,7 +235,7 @@ impl FromRequest for ConnectionInfo {
|
||||
/// # let _svc = actix_web::web::to(handler);
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Display)]
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
pub struct PeerAddr(pub SocketAddr);
|
||||
|
||||
impl PeerAddr {
|
||||
@ -247,7 +247,7 @@ impl PeerAddr {
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[non_exhaustive]
|
||||
#[display(fmt = "Missing peer address")]
|
||||
#[display("Missing peer address")]
|
||||
pub struct MissingPeerAddr;
|
||||
|
||||
impl ResponseError for MissingPeerAddr {}
|
||||
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use actix_router::PathDeserializer;
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use derive_more::{AsRef, Deref, DerefMut, Display, From};
|
||||
use derive_more::derive::{AsRef, Deref, DerefMut, Display, From};
|
||||
use serde::de;
|
||||
|
||||
use crate::{
|
||||
@ -152,14 +152,14 @@ impl PathConfig {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use actix_router::ResourceDef;
|
||||
use derive_more::Display;
|
||||
use derive_more::derive::Display;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::*;
|
||||
use crate::{error, http, test::TestRequest, HttpResponse};
|
||||
|
||||
#[derive(Deserialize, Debug, Display)]
|
||||
#[display(fmt = "MyStruct({}, {})", key, value)]
|
||||
#[display("MyStruct({}, {})", key, value)]
|
||||
struct MyStruct {
|
||||
key: String,
|
||||
value: String,
|
||||
|
@ -187,7 +187,7 @@ impl QueryConfig {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use actix_http::StatusCode;
|
||||
use derive_more::Display;
|
||||
use derive_more::derive::Display;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::*;
|
||||
|
Reference in New Issue
Block a user