From 44be153e7dc0e9d3d2c28267203d954c92eed778 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Fri, 3 Jan 2025 21:33:05 -0800 Subject: [PATCH] Use clap's dynamic String feature rather than another dependency --- Cargo.lock | 27 --------------------------- Cargo.toml | 3 +-- src/options.rs | 9 ++++----- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1315eacd3c..0e96887f08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,26 +176,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[package]] -name = "const_format" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -266,7 +246,6 @@ dependencies = [ "bumpalo", "cc", "clap", - "const_format", "crossterm", "glob", "hashbrown", @@ -1286,12 +1265,6 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" -[[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.2" diff --git a/Cargo.toml b/Cargo.toml index e6f9d7e74c..e60411ef54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ pkg-fmt = "zip" [dependencies] regex = "1.10.4" -clap = { version = "4.0.0", features = ["cargo", "env", "wrap_help"] } +clap = { version = "4.0.0", features = ["cargo", "env", "wrap_help", "string"] } itertools = "0.11.0" typed-arena = "2.0.2" rustc-hash = "2.0.0" @@ -55,7 +55,6 @@ radix-heap = "0.4.2" # a slightly more aggressive MSRV than difftastic. Constrain ignore to # a known-good max version. ignore = ">= 0.4, < 0.4.24" -const_format = "0.2.22" owo-colors = "3.5.0" wu-diff = "0.1.2" rayon = "1.7.0" diff --git a/src/options.rs b/src/options.rs index 73c22591aa..9ac6ba7401 100644 --- a/src/options.rs +++ b/src/options.rs @@ -8,7 +8,6 @@ use std::{ }; use clap::{crate_authors, crate_description, value_parser, Arg, ArgAction, Command}; -use const_format::formatcp; use crossterm::tty::IsTty; use itertools::Itertools; @@ -169,7 +168,7 @@ fn app() -> clap::Command { .action(ArgAction::Set) .long_help("Treat a tab as this many spaces.") .env("DFT_TAB_WIDTH") - .default_value(formatcp!("{}", DEFAULT_TAB_WIDTH)) + .default_value(format!("{}", DEFAULT_TAB_WIDTH)) .value_parser(clap::value_parser!(usize)) .required(false), ) @@ -287,7 +286,7 @@ When multiple overrides are specified, the first matching override wins.")) .value_name("LIMIT") .action(ArgAction::Set) .help("Use a text diff if either input file exceeds this size.") - .default_value(formatcp!("{}", DEFAULT_BYTE_LIMIT)) + .default_value(format!("{}", DEFAULT_BYTE_LIMIT)) .env("DFT_BYTE_LIMIT") .value_parser(clap::value_parser!(usize)) .required(false), @@ -296,7 +295,7 @@ When multiple overrides are specified, the first matching override wins.")) Arg::new("graph-limit").long("graph-limit") .value_name("LIMIT") .help("Use a text diff if the structural graph exceed this number of nodes in memory.") - .default_value(formatcp!("{}", DEFAULT_GRAPH_LIMIT)) + .default_value(format!("{}", DEFAULT_GRAPH_LIMIT)) .action(ArgAction::Set) .env("DFT_GRAPH_LIMIT") .value_parser(clap::value_parser!(usize)) @@ -307,7 +306,7 @@ When multiple overrides are specified, the first matching override wins.")) .value_name("LIMIT") .action(ArgAction::Set) .help("Use a text diff if the number of parse errors exceeds this value.") - .default_value(formatcp!("{}", DEFAULT_PARSE_ERROR_LIMIT)) + .default_value(format!("{}", DEFAULT_PARSE_ERROR_LIMIT)) .env("DFT_PARSE_ERROR_LIMIT") .value_parser(clap::value_parser!(usize)) .required(false),