From e43adad089928473a5a91c46b5e929463065d2ae Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 14 Aug 2024 13:03:46 +0300 Subject: [PATCH] Correct usage --- Cargo.lock | 8 ++++++++ api/s3/Cargo.toml | 1 + api/s3/src/lib.rs | 15 +++++---------- lib/Cargo.toml | 2 +- lib/src/lib.rs | 3 +-- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5923103..c02b4da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,6 +230,7 @@ name = "baza-api-s3" version = "0.0.0" dependencies = [ "baza-lib", + "derive_more 1.0.0", "hyper", "s3-server", "secrecy", @@ -673,6 +674,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.48", + "unicode-xid", ] [[package]] @@ -2662,6 +2664,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "utf8parse" version = "0.2.1" diff --git a/api/s3/Cargo.toml b/api/s3/Cargo.toml index 8d762eb..8cdb8b7 100644 --- a/api/s3/Cargo.toml +++ b/api/s3/Cargo.toml @@ -10,6 +10,7 @@ publish = false [dependencies] baza = { package = "baza-lib", path = "../../lib" } +derive_more = { version = "1", features = ["display", "error", "from"] } hyper = "0.14" s3-server = "0.2" secrecy = "0.8" diff --git a/api/s3/src/lib.rs b/api/s3/src/lib.rs index 3dabb95..f7da361 100644 --- a/api/s3/src/lib.rs +++ b/api/s3/src/lib.rs @@ -1,14 +1,12 @@ //! S3 HTTP API implementation of Baza. -// TODO: Remove on next `derive_more` major version upgrade. -#![allow(clippy::uninlined_format_args)] - use std::{ convert::Infallible, fmt, io, net::{TcpListener, ToSocketAddrs}, }; +use derive_more::{Display, Error, From}; use hyper::{server::Server, service::make_service_fn}; use s3_server::{ dto, @@ -19,11 +17,8 @@ use secrecy::{ExposeSecret as _, SecretString}; use tokio_util::{compat::FuturesAsyncReadCompatExt as _, io::ReaderStream}; use baza::{ - async_trait, - derive_more::{Display, Error, From}, - futures::future, - tracing, CreateFile, CreateSymlink, Exec, GetFile, ReadOnlyFile, - RelativePath, + async_trait, futures::future, tracing, CreateFile, CreateSymlink, Exec, + GetFile, ReadOnlyFile, RelativePath, }; /// [`dto::PutObjectRequest::metadata`] key where [`CreateSymlink::src`] is @@ -67,11 +62,11 @@ where #[derive(Debug, Display, Error, From)] pub enum RunHttpServerError { /// Failed to bind address. - #[display(fmt = "Failed to bind address: {}", _0)] + #[display("Failed to bind address: {_0}")] BindAddress(io::Error), /// [`hyper`] server failure. - #[display(fmt = "Hyper server failed: {}", _0)] + #[display("Hyper server failed: {_0}")] Hyper(hyper::Error), } diff --git a/lib/Cargo.toml b/lib/Cargo.toml index c97dd9a..f2b08b0 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,7 +11,7 @@ publish = false [dependencies] async-fs = "2.1" async-trait = "0.1" -derive_more = "1.0" +derive_more = { version = "1", features = ["display", "error"] } futures = "0.3" tracerr = "0.3" tracing = "0.1" diff --git a/lib/src/lib.rs b/lib/src/lib.rs index ab9bf26..457c0c6 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -12,7 +12,6 @@ use tracerr::Traced; use uuid::Uuid; pub use async_trait::async_trait; -pub use derive_more; pub use futures; pub use tracing; @@ -264,7 +263,7 @@ impl TryFrom for RelativePath { /// Error of parsing [`RelativePath`] from a [`String`]. #[derive(Debug, Display, Error)] -#[display(fmt = "Invalid `RelativePath` format")] +#[display("Invalid `RelativePath` format")] pub struct InvalidRelativePathError; #[cfg(test)]