diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index f7ef125..30056e9 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -27,4 +27,4 @@ jobs: - name: Test examples env: RUSTFLAGS: -A dead-code -A unused-variables - run: just check-examples + run: just test diff --git a/examples/Cargo.lock b/examples/Cargo.lock index c6bccdf..bf39ddb 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -56,7 +56,7 @@ dependencies = [ "actix-web", "bitflags 2.5.0", "bytes", - "derive_more", + "derive_more 0.99.18", "futures-core", "http-range", "log", @@ -84,7 +84,7 @@ dependencies = [ "brotli", "bytes", "bytestring", - "derive_more", + "derive_more 0.99.18", "encoding_rs", "flate2", "futures-core", @@ -180,7 +180,7 @@ dependencies = [ "actix-utils", "actix-web", "anyhow", - "derive_more", + "derive_more 0.99.18", "serde", "serde_json", "tracing", @@ -238,7 +238,7 @@ dependencies = [ "bytestring", "cfg-if", "cookie", - "derive_more", + "derive_more 0.99.18", "encoding_rs", "futures-core", "futures-util", @@ -991,6 +991,27 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "unicode-xid", +] + [[package]] name = "diesel" version = "2.2.2" @@ -1793,7 +1814,7 @@ name = "my_errors" version = "1.0.0" dependencies = [ "actix-web", - "derive_more", + "derive_more 1.0.0", "env_logger", "log", ] @@ -3152,6 +3173,12 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "universal-hash" version = "0.5.1" diff --git a/examples/errors/Cargo.toml b/examples/errors/Cargo.toml index 007796d..698dbc4 100644 --- a/examples/errors/Cargo.toml +++ b/examples/errors/Cargo.toml @@ -6,6 +6,6 @@ edition.workspace = true [dependencies] actix-web = "4" -derive_more = "0.99" +derive_more = { version = "1", features = ["display", "error"] } env_logger = "0.11" log = "0.4" diff --git a/examples/errors/src/logging.rs b/examples/errors/src/logging.rs index 8066620..055fae4 100644 --- a/examples/errors/src/logging.rs +++ b/examples/errors/src/logging.rs @@ -1,10 +1,10 @@ // use actix_web::{error, get, middleware::Logger, App, HttpServer, Result}; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use log::info; #[derive(Debug, Display, Error)] -#[display(fmt = "my error: {}", name)] +#[display("my error: {name}")] pub struct MyError { name: &'static str, } diff --git a/examples/errors/src/main.rs b/examples/errors/src/main.rs index 8b8455c..567cfac 100644 --- a/examples/errors/src/main.rs +++ b/examples/errors/src/main.rs @@ -6,10 +6,10 @@ pub mod recommend_two; // use actix_web::{error, Result}; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; #[derive(Debug, Display, Error)] -#[display(fmt = "my error: {}", name)] +#[display("my error: {name}")] struct MyError { name: &'static str, } diff --git a/examples/errors/src/override_error.rs b/examples/errors/src/override_error.rs index e1e80b6..3ba7e60 100644 --- a/examples/errors/src/override_error.rs +++ b/examples/errors/src/override_error.rs @@ -4,17 +4,17 @@ use actix_web::{ http::{header::ContentType, StatusCode}, App, HttpResponse, }; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; #[derive(Debug, Display, Error)] enum MyError { - #[display(fmt = "internal error")] + #[display("internal error")] InternalError, - #[display(fmt = "bad request")] + #[display("bad request")] BadClientData, - #[display(fmt = "timeout")] + #[display("timeout")] Timeout, } diff --git a/examples/errors/src/recommend_one.rs b/examples/errors/src/recommend_one.rs index 382b9c8..bf353d7 100644 --- a/examples/errors/src/recommend_one.rs +++ b/examples/errors/src/recommend_one.rs @@ -4,11 +4,11 @@ use actix_web::{ http::{header::ContentType, StatusCode}, App, HttpResponse, HttpServer, }; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; #[derive(Debug, Display, Error)] enum UserError { - #[display(fmt = "Validation error on field: {}", field)] + #[display("Validation error on field: {field}")] ValidationError { field: String }, } diff --git a/examples/errors/src/recommend_two.rs b/examples/errors/src/recommend_two.rs index 2f8d5aa..f8cd7df 100644 --- a/examples/errors/src/recommend_two.rs +++ b/examples/errors/src/recommend_two.rs @@ -4,11 +4,11 @@ use actix_web::{ http::{header::ContentType, StatusCode}, App, HttpResponse, HttpServer, }; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; #[derive(Debug, Display, Error)] enum UserError { - #[display(fmt = "An internal error occurred. Please try again later.")] + #[display("An internal error occurred. Please try again later.")] InternalError, } diff --git a/justfile b/justfile index 861cec2..7fa6ba2 100644 --- a/justfile +++ b/justfile @@ -1,2 +1,6 @@ -check-examples: +_list: + @just --list + +# Tests examples. +test: cd examples && cargo test