diff --git a/Cargo.lock b/Cargo.lock index d5c319a7..f7ddf8b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -211,7 +211,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -292,36 +292,35 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive_arbitrary" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] -name = "derive_arbitrary" -version = "1.3.2" +name = "derive_more" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", + "derive_more-impl", ] [[package]] -name = "derive_more" -version = "0.99.18" +name = "derive_more-impl" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", + "unicode-xid", ] [[package]] @@ -342,7 +341,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -435,7 +434,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -461,7 +460,6 @@ dependencies = [ "concat_const", "cstr", "curl-sys", - "derivative", "derive_more", "digest", "either", @@ -485,7 +483,7 @@ dependencies = [ "semver", "sha1", "shared_child", - "syn 2.0.79", + "syn", "tar", "target", "tee", @@ -515,7 +513,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -741,7 +739,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -878,7 +876,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -914,17 +912,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.79" @@ -989,7 +976,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1034,6 +1021,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "url" version = "2.5.2" @@ -1189,7 +1182,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 89d1a25c..5fefdb70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ bzip2 = "0.4" byteorder = "1" cfg-if = "1" cstr = "0.2.10" -derivative = "2" digest = "0.10" either = "1" getset = "0.1" @@ -78,9 +77,9 @@ version = "0.4" default-features = false [dependencies.derive_more] -version = "0.99" +version = "1" default-features = false -features = ["deref", "display", "from", "try_into"] +features = ["deref", "display", "debug", "from", "try_into"] [dependencies.flate2] version = "1" diff --git a/src/hg_connect_http.rs b/src/hg_connect_http.rs index 56740262..66e658e3 100644 --- a/src/hg_connect_http.rs +++ b/src/hg_connect_http.rs @@ -27,6 +27,7 @@ use curl_sys::{ CURLOPT_POSTFIELDSIZE_LARGE, CURLOPT_READDATA, CURLOPT_READFUNCTION, CURLOPT_URL, CURLOPT_USERAGENT, CURLOPT_VERBOSE, CURLOPT_WRITEFUNCTION, }; +use derive_more::Debug; use either::Either; use flate2::read::ZlibDecoder; use itertools::Itertools; @@ -258,15 +259,14 @@ struct HttpResponseInfo { content_type: Option, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct HttpResponse { info: HttpResponseInfo, thread: Option>>, cursor: Cursor, receiver: Option>, #[allow(dead_code)] - #[derivative(Debug = "ignore")] + #[debug(skip)] token: Arc, } diff --git a/src/hg_data.rs b/src/hg_data.rs index e8f27a4e..ba6d61d7 100644 --- a/src/hg_data.rs +++ b/src/hg_data.rs @@ -6,6 +6,7 @@ use std::borrow::Cow; use std::io::Write; use bstr::{BStr, ByteSlice}; +use derive_more::Debug; use once_cell::sync::Lazy; use regex::bytes::Regex; @@ -29,12 +30,11 @@ pub struct HgAuthorship> { #[derive(Clone)] pub struct HgCommitter>(pub B); -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] struct Authorship<'a> { - #[derivative(Debug(format_with = "crate::util::bstr_fmt"))] + #[debug("{}", name.as_bstr())] name: Cow<'a, [u8]>, - #[derivative(Debug(format_with = "crate::util::bstr_fmt"))] + #[debug("{}", email.as_bstr())] email: Cow<'a, [u8]>, timestamp: u64, utcoffset: i32, diff --git a/src/main.rs b/src/main.rs index 0d704a25..8d19727b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,8 +39,6 @@ #![deny(clippy::unused_self)] #![allow(unknown_lints)] -#[macro_use] -extern crate derivative; #[macro_use] extern crate log; diff --git a/src/tree_util.rs b/src/tree_util.rs index 0310dff4..5673447f 100644 --- a/src/tree_util.rs +++ b/src/tree_util.rs @@ -11,16 +11,16 @@ use std::io::{self, Write}; use std::iter::{zip, Peekable}; use bstr::{BStr, BString, ByteSlice}; +use derive_more::Debug; use either::Either; use itertools::EitherOrBoth; use crate::util::{ImmutBString, Map, MapMap, Transpose}; /// Wrapper type that pairs a value of any type with a path string. -#[derive(Clone, Derivative, PartialEq, Eq, PartialOrd, Ord)] -#[derivative(Debug)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct WithPath { - #[derivative(Debug(format_with = "crate::util::bstr_fmt"))] + #[debug("{}", path.as_bstr())] path: ImmutBString, inner: T, } diff --git a/src/util.rs b/src/util.rs index e0a9123c..591ba6fb 100644 --- a/src/util.rs +++ b/src/util.rs @@ -222,10 +222,6 @@ impl FromBytes for T { } } -pub fn bstr_fmt>(s: &S, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(s.as_ref().as_bstr(), f) -} - pub trait OptionExt { fn as_ptr(&self) -> *const T; } diff --git a/src/version.rs b/src/version.rs index a9a9b39c..d31d9fad 100644 --- a/src/version.rs +++ b/src/version.rs @@ -13,7 +13,7 @@ use crate::git::CommitId; use crate::{experiment, get_typed_config, ConfigType, Experiments}; #[derive(Clone, Display, Debug)] -#[display(fmt = "{version}")] +#[display("{version}")] pub struct Version { version: semver::Version, tag_has_v_prefix: bool, diff --git a/src/xdiff.rs b/src/xdiff.rs index bd93e22f..dd5cc1f0 100644 --- a/src/xdiff.rs +++ b/src/xdiff.rs @@ -5,8 +5,10 @@ use std::ffi::c_void; use std::marker::PhantomData; use std::os::raw::{c_char, c_int, c_long, c_ulong}; +use std::ptr::NonNull; use bstr::ByteSlice; +use derive_more::Debug; use crate::util::ImmutBString; @@ -30,27 +32,23 @@ impl<'a> From<&'a [u8]> for mmfile_t<'a> { #[allow(non_camel_case_types)] #[repr(C)] -#[derive(Derivative)] -#[derivative(Default)] +#[derive(Default)] struct xpparam_t { flags: c_ulong, - #[derivative(Default(value = "std::ptr::null()"))] - anchors: *const *const c_char, + anchors: Option>, anchors_nr: usize, } #[allow(non_camel_case_types)] #[repr(C)] -#[derive(Derivative)] -#[derivative(Default)] +#[derive(Default)] struct xdemitconf_t { ctxlen: c_long, interhunkctxlen: c_long, flags: c_ulong, find_func: Option c_long>, - #[derivative(Default(value = "std::ptr::null_mut()"))] - find_func_priv: *mut c_void, + find_func_priv: Option>, hunk_func: Option c_int>, } @@ -68,12 +66,11 @@ extern "C" { ) -> c_int; } -#[derive(Clone, Copy, Derivative)] -#[derivative(Debug)] +#[derive(Clone, Copy, Debug)] pub struct PatchInfo> { pub start: usize, pub end: usize, - #[derivative(Debug(format_with = "crate::util::bstr_fmt"))] + #[debug("{}", data.as_ref().as_bstr())] pub data: S, }