From 0e84072f09c6f2c20f094d190f50561781a39341 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Sun, 30 Jun 2024 23:35:04 -0700 Subject: [PATCH 01/16] [draft] Upgrade `structopt` to `clap` Still need to finish this off, one test fails. `structopt` was build on clap 2, and then its features were integrated into clap 3. So it's not actually a heavier dependency. May have to check on MSRV issues. Once we merge this, we only have one version of `syn`, which reduces our dependency size significantly. --- cargo-insta/Cargo.toml | 2 +- cargo-insta/src/cli.rs | 169 ++++++++++++++++++++++------------------- 2 files changed, 91 insertions(+), 80 deletions(-) diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index 5ffa1f67..dbbc7990 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -16,7 +16,6 @@ readme = "README.md" insta = { version = "=1.39.0", path = "../insta", features = ["json", "yaml", "redactions", "_cargo_insta_internal"] } cargo_metadata = { version = "0.18.0", default-features = false } console = "0.15.4" -structopt = { version = "0.3.26", default-features = false } serde = { version = "1.0.117", features = ["derive"] } serde_json = "1.0.59" proc-macro2 = { version = "1.0.24", features = ["span-locations"] } @@ -24,6 +23,7 @@ syn = { version = "1.0.50", features = ["full", "visit", "extra-traits"] } ignore = "0.4.17" uuid = { version = "1.0.0", features = ["v4"] } tempfile = "3.5.0" +clap = { version = "4.3", features = ["derive"] } [dev-dependencies] walkdir = "2.3.1" diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index c9e36f56..f29e7db6 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -12,8 +12,6 @@ use insta::_cargo_insta_support::{ is_ci, SnapshotPrinter, SnapshotUpdate, TestRunner, ToolConfig, UnreferencedSnapshots, }; use serde::Serialize; -use structopt::clap::AppSettings; -use structopt::StructOpt; use uuid::Uuid; use crate::cargo::{find_snapshot_roots, get_metadata, Metadata, Package}; @@ -21,209 +19,222 @@ use crate::container::{Operation, SnapshotContainer}; use crate::utils::{err_msg, QuietExit}; use crate::walk::{find_snapshots, make_deletion_walker, make_snapshot_walker, FindFlags}; +use clap::{builder::PossibleValuesParser, Args, Parser, Subcommand, ValueEnum}; + /// A helper utility to work with insta snapshots. -#[derive(StructOpt, Debug)] -#[structopt( +#[derive(Parser, Debug)] +#[command( bin_name = "cargo insta", - setting = AppSettings::ArgRequiredElseHelp, - global_setting = AppSettings::ColorNever, - global_setting = AppSettings::UnifiedHelpMessage, - global_setting = AppSettings::DeriveDisplayOrder, - global_setting = AppSettings::DontCollapseArgsInUsage + arg_required_else_help = true, + // TODO: do we want these? + disable_colored_help = true, + disable_version_flag = true, + next_line_help = true )] struct Opts { /// Coloring - #[structopt(long, global = true, value_name = "WHEN", possible_values=&["auto", "always", "never"])] + #[arg(long, global = true, value_name = "WHEN", value_parser = ["auto", "always", "never"])] color: Option, - #[structopt(subcommand)] + #[command(subcommand)] command: Command, } -#[derive(StructOpt, Debug)] -#[structopt( - bin_name = "cargo insta", +#[derive(ValueEnum, Clone, Debug)] +enum ColorWhen { + Auto, + Always, + Never, +} + +#[derive(Subcommand, Debug)] +#[command( after_help = "For the online documentation of the latest version, see https://insta.rs/docs/cli/." )] #[allow(clippy::large_enum_variant)] enum Command { /// Interactively review snapshots - #[structopt(name = "review", alias = "verify")] + #[command(alias = "verify")] Review(ProcessCommand), /// Rejects all snapshots - #[structopt(name = "reject")] Reject(ProcessCommand), /// Accept all snapshots - #[structopt(name = "accept", alias = "approve")] + #[command(alias = "approve")] Accept(ProcessCommand), /// Run tests and then reviews - #[structopt(name = "test")] Test(TestCommand), /// Print a summary of all pending snapshots. - #[structopt(name = "pending-snapshots")] PendingSnapshots(PendingSnapshotsCommand), /// Shows a specific snapshot - #[structopt(name = "show")] Show(ShowCommand), } -#[derive(StructOpt, Debug, Clone)] -#[structopt(rename_all = "kebab-case")] +#[derive(Args, Debug, Clone)] struct TargetArgs { /// Path to Cargo.toml - #[structopt(long, value_name = "PATH", parse(from_os_str))] + #[arg(long, value_name = "PATH")] manifest_path: Option, /// Explicit path to the workspace root - #[structopt(long, value_name = "PATH", parse(from_os_str))] + #[arg(long, value_name = "PATH")] workspace_root: Option, - /// Sets the extensions to consider. Defaults to `.snap` - #[structopt(short = "e", long, value_name = "EXTENSIONS", multiple = true)] + /// Sets the extensions to consider. Defaults to `.snap` + #[arg(short = 'e', long, value_name = "EXTENSIONS", num_args = 1.., value_delimiter = ',')] extensions: Vec, /// Work on all packages in the workspace - #[structopt(long)] + #[arg(long)] workspace: bool, /// Alias for --workspace (deprecated) - #[structopt(long)] + #[arg(long)] all: bool, /// Also walk into ignored paths. - #[structopt(long, alias = "no-ignore")] + #[arg(long, alias = "no-ignore")] include_ignored: bool, /// Also include hidden paths. - #[structopt(long)] + #[arg(long)] include_hidden: bool, } -#[derive(StructOpt, Debug)] -#[structopt(rename_all = "kebab-case")] +#[derive(Args, Debug)] struct ProcessCommand { - #[structopt(flatten)] + #[command(flatten)] target_args: TargetArgs, /// Limits the operation to one or more snapshots. - #[structopt(long = "snapshot")] + #[arg(long = "snapshot")] snapshot_filter: Option>, /// Do not print to stdout. - #[structopt(short = "q", long)] + #[arg(short = 'q', long)] quiet: bool, } -#[derive(StructOpt, Debug)] -#[structopt(rename_all = "kebab-case")] +#[derive(Args, Debug)] +#[command(rename_all = "kebab-case")] struct TestCommand { - #[structopt(flatten)] + #[command(flatten)] target_args: TargetArgs, /// Test only this package's library unit tests - #[structopt(long)] + #[arg(long)] lib: bool, /// Test only the specified binary - #[structopt(long)] + #[arg(long)] bin: Option, /// Test all binaries - #[structopt(long)] + #[arg(long)] bins: bool, /// Test only the specified example - #[structopt(long)] + #[arg(long)] example: Option, /// Test all examples - #[structopt(long)] + #[arg(long)] examples: bool, /// Test only the specified test targets - #[structopt(long)] + #[arg(long)] test: Vec, /// Test all tests - #[structopt(long)] + #[arg(long)] tests: bool, /// Package to run tests for - #[structopt(short = "p", long)] + #[arg(short = 'p', long)] package: Vec, /// Exclude packages from the test - #[structopt(long, value_name = "SPEC")] + #[arg(long, value_name = "SPEC")] exclude: Option, /// Disable force-passing of snapshot tests - #[structopt(long)] + #[arg(long)] no_force_pass: bool, /// Prevent running all tests regardless of failure - #[structopt(long)] + #[arg(long)] fail_fast: bool, /// Space-separated list of features to activate - #[structopt(long, value_name = "FEATURES")] + #[arg(long, value_name = "FEATURES")] features: Option, /// Number of parallel jobs, defaults to # of CPUs - #[structopt(short = "j", long)] + #[arg(short = 'j', long)] jobs: Option, /// Build artifacts in release mode, with optimizations - #[structopt(long)] + #[arg(long)] release: bool, /// Build artifacts with the specified profile - #[structopt(long)] + #[arg(long)] profile: Option, /// Test all targets (does not include doctests) - #[structopt(long)] + #[arg(long)] all_targets: bool, /// Activate all available features - #[structopt(long)] + #[arg(long)] all_features: bool, /// Do not activate the `default` feature - #[structopt(long)] + #[arg(long)] no_default_features: bool, /// Build for the target triple - #[structopt(long)] + #[arg(long)] target: Option, /// Follow up with review. - #[structopt(long)] + #[arg(long)] review: bool, /// Accept all snapshots after test. - #[structopt(long, conflicts_with = "review")] + #[arg(long, conflicts_with = "review")] accept: bool, /// Accept all new (previously unseen). - #[structopt(long)] + #[arg(long)] accept_unseen: bool, /// Instructs the test command to just assert. - #[structopt(long)] + #[arg(long)] check: bool, /// Do not reject pending snapshots before run. - #[structopt(long)] + #[arg(long)] keep_pending: bool, /// Update all snapshots even if they are still matching. - #[structopt(long)] + #[arg(long)] force_update_snapshots: bool, /// Require metadata as well as snapshots' contents to match. - #[structopt(long)] + #[arg(long)] require_full_match: bool, /// Handle unreferenced snapshots after a successful test run. - #[structopt(long, default_value="ignore", possible_values=&["ignore", "warn", "reject", "delete", "auto"])] + #[arg( + long, + default_value = "ignore", + // TODO: could try and implement a clap trait on TestRunner struct from + // `cargo-insta` and avoid the repetition + value_parser = PossibleValuesParser::new(["ignore", "warn", "reject", "delete", "auto"]) + )] unreferenced: String, /// Delete unreferenced snapshots after a successful test run. - #[structopt(long, hidden = true)] + #[arg(long, hide = true)] delete_unreferenced_snapshots: bool, /// Filters to apply to the insta glob feature. - #[structopt(long)] + #[arg(long)] glob_filter: Vec, /// Do not pass the quiet flag (`-q`) to tests. - #[structopt(short = "Q", long)] + #[arg(short = 'Q', long)] no_quiet: bool, /// Picks the test runner. - #[structopt(long, default_value="auto", possible_values=&["auto", "cargo-test", "nextest"])] + #[arg( + long, + default_value = "auto", + // TODO: could try and implement a clap trait on TestRunner struct from + // `cargo-insta` and avoid the repetition + value_parser = PossibleValuesParser::new(["auto", "cargo-test", "nextest"]) + )] test_runner: String, /// Options passed to cargo test - // Sets raw to true so that `--` is required - #[structopt(name = "CARGO_TEST_ARGS", raw(true))] + #[arg(last = true)] cargo_options: Vec, } -#[derive(StructOpt, Debug)] -#[structopt(rename_all = "kebab-case")] +#[derive(Args, Debug)] +#[command(rename_all = "kebab-case")] struct PendingSnapshotsCommand { - #[structopt(flatten)] + #[command(flatten)] target_args: TargetArgs, /// Changes the output from human readable to JSON. - #[structopt(long)] + #[arg(long)] as_json: bool, } -#[derive(StructOpt, Debug)] -#[structopt(rename_all = "kebab-case")] +#[derive(Args, Debug)] +#[command(rename_all = "kebab-case")] struct ShowCommand { - #[structopt(flatten)] + #[command(flatten)] target_args: TargetArgs, /// The path to the snapshot file. path: PathBuf, @@ -1094,7 +1105,7 @@ pub(crate) fn run() -> Result<(), Box> { args.remove(1); } - let opts = Opts::from_iter(args); + let opts = Opts::parse_from(args); let color = handle_color(opts.color.as_deref())?; match opts.command { From c2c1f88e1c5dba6fe0fcf472383323ade0e42c5d Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Wed, 3 Jul 2024 20:08:40 -0700 Subject: [PATCH 02/16] take advantage of some clap features to simplify the code --- Cargo.toml | 7 +++- cargo-insta/Cargo.toml | 2 +- cargo-insta/src/cli.rs | 91 +++++++++++++++++------------------------- insta/Cargo.toml | 3 +- insta/src/env.rs | 4 +- 5 files changed, 47 insertions(+), 60 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3ddeb14d..364bbaaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,12 +4,15 @@ members = ["cargo-insta"] [workspace.metadata.dist] cargo-dist-version = "0.12.0" ci = ["github"] +install-updater = false installers = ["shell", "powershell"] -targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] pr-run-mode = "plan" -install-updater = false precise-builds = true +targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] [profile.dist] inherits = "release" lto = "thin" + +[workspace.dependencies] +clap = {version = "4.3", features = ["derive", "env"]} diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index dbbc7990..5aec553c 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -23,7 +23,7 @@ syn = { version = "1.0.50", features = ["full", "visit", "extra-traits"] } ignore = "0.4.17" uuid = { version = "1.0.0", features = ["v4"] } tempfile = "3.5.0" -clap = { version = "4.3", features = ["derive"] } +clap = { workspace=true} [dev-dependencies] walkdir = "2.3.1" diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index f29e7db6..2f232284 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -1,8 +1,8 @@ use std::borrow::{Borrow, Cow}; -use std::collections::HashSet; use std::error::Error; use std::fmt::Display; use std::path::{Path, PathBuf}; +use std::{collections::HashSet, fmt}; use std::{env, fs}; use std::{io, process}; @@ -19,7 +19,7 @@ use crate::container::{Operation, SnapshotContainer}; use crate::utils::{err_msg, QuietExit}; use crate::walk::{find_snapshots, make_deletion_walker, make_snapshot_walker, FindFlags}; -use clap::{builder::PossibleValuesParser, Args, Parser, Subcommand, ValueEnum}; +use clap::{Args, Parser, Subcommand, ValueEnum}; /// A helper utility to work with insta snapshots. #[derive(Parser, Debug)] @@ -33,20 +33,30 @@ use clap::{builder::PossibleValuesParser, Args, Parser, Subcommand, ValueEnum}; )] struct Opts { /// Coloring - #[arg(long, global = true, value_name = "WHEN", value_parser = ["auto", "always", "never"])] - color: Option, + #[arg(long, global = true, value_name = "WHEN", env = "CARGO_TERM_COLOR")] + color: Option, #[command(subcommand)] command: Command, } -#[derive(ValueEnum, Clone, Debug)] +#[derive(ValueEnum, Copy, Clone, Debug)] enum ColorWhen { Auto, Always, Never, } +impl fmt::Display for ColorWhen { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ColorWhen::Auto => write!(f, "auto"), + ColorWhen::Always => write!(f, "always"), + ColorWhen::Never => write!(f, "never"), + } + } +} + #[derive(Subcommand, Debug)] #[command( after_help = "For the online documentation of the latest version, see https://insta.rs/docs/cli/." @@ -190,14 +200,8 @@ struct TestCommand { #[arg(long)] require_full_match: bool, /// Handle unreferenced snapshots after a successful test run. - #[arg( - long, - default_value = "ignore", - // TODO: could try and implement a clap trait on TestRunner struct from - // `cargo-insta` and avoid the repetition - value_parser = PossibleValuesParser::new(["ignore", "warn", "reject", "delete", "auto"]) - )] - unreferenced: String, + #[arg(long, default_value = "ignore")] + unreferenced: UnreferencedSnapshots, /// Delete unreferenced snapshots after a successful test run. #[arg(long, hide = true)] delete_unreferenced_snapshots: bool, @@ -208,14 +212,8 @@ struct TestCommand { #[arg(short = 'Q', long)] no_quiet: bool, /// Picks the test runner. - #[arg( - long, - default_value = "auto", - // TODO: could try and implement a clap trait on TestRunner struct from - // `cargo-insta` and avoid the repetition - value_parser = PossibleValuesParser::new(["auto", "cargo-test", "nextest"]) - )] - test_runner: String, + #[arg(long, default_value = "auto")] + test_runner: TestRunner, /// Options passed to cargo test #[arg(last = true)] cargo_options: Vec, @@ -336,22 +334,15 @@ fn query_snapshot( } } -fn handle_color(color: Option<&str>) -> Result<&'static str, Box> { - match &*color - .map(Cow::Borrowed) - .or_else(|| std::env::var("CARGO_TERM_COLOR").ok().map(Cow::Owned)) - .unwrap_or(Cow::Borrowed("auto")) - { - "always" => { +fn handle_color(color: Option) { + match color { + Some(ColorWhen::Always) => { set_colors_enabled(true); - Ok("always") } - "auto" => Ok("auto"), - "never" => { + Some(ColorWhen::Never) => { set_colors_enabled(false); - Ok("never") } - color => Err(err_msg(format!("invalid value for --color: {}", color))), + Some(ColorWhen::Auto) | None => {} } } @@ -570,7 +561,7 @@ fn process_snapshots( Ok(()) } -fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box> { +fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box> { let loc = handle_target_args(&cmd.target_args)?; match loc.tool_config.snapshot_update() { SnapshotUpdate::Auto => { @@ -612,21 +603,11 @@ fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box> { // Legacy command if cmd.delete_unreferenced_snapshots { println!("Warning: `--delete-unreferenced-snapshots` is deprecated. Use `--unreferenced=delete` instead."); - cmd.unreferenced = "delete".into(); + cmd.unreferenced = UnreferencedSnapshots::Delete; } - let test_runner = cmd - .test_runner - .parse() - .map_err(|_| err_msg("invalid test runner preference"))?; - - let unreferenced = cmd - .unreferenced - .parse() - .map_err(|_| err_msg("invalid value for --unreferenced"))?; - let (mut proc, snapshot_ref_file, prevents_doc_run) = - prepare_test_runner(test_runner, unreferenced, &cmd, color, &[], None)?; + prepare_test_runner(cmd.test_runner, cmd.unreferenced, &cmd, color, &[], None)?; if !cmd.keep_pending { process_snapshots(true, None, &loc, Some(Operation::Reject))?; @@ -636,10 +617,10 @@ fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box> { let mut success = status.success(); // nextest currently cannot run doctests, run them with regular tests - if matches!(test_runner, TestRunner::Nextest) && !prevents_doc_run { + if matches!(cmd.test_runner, TestRunner::Nextest) && !prevents_doc_run { let (mut proc, _, _) = prepare_test_runner( TestRunner::CargoTest, - unreferenced, + cmd.unreferenced, &cmd, color, &["--doc"], @@ -660,7 +641,7 @@ fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box> { // tests ran successfully if success { if let Some(ref path) = snapshot_ref_file { - handle_unreferenced_snapshots(path.borrow(), &loc, unreferenced, &cmd.package[..])?; + handle_unreferenced_snapshots(path.borrow(), &loc, cmd.unreferenced, &cmd.package[..])?; } } @@ -801,7 +782,7 @@ fn prepare_test_runner<'snapshot_ref>( test_runner: TestRunner, unreferenced: UnreferencedSnapshots, cmd: &TestCommand, - color: &str, + color: ColorWhen, extra_args: &[&str], snapshot_ref_file: Option<&'snapshot_ref Path>, ) -> Result<(process::Command, Option>, bool), Box> { @@ -952,7 +933,7 @@ fn prepare_test_runner<'snapshot_ref>( proc.arg(target); } proc.arg("--color"); - proc.arg(color); + proc.arg(color.to_string()); proc.args(extra_args); // Items after this are passed to the test runner proc.arg("--"); @@ -968,7 +949,9 @@ fn prepare_test_runner<'snapshot_ref>( // We also only want to do this if we override auto as some custom test runners // do not handle --color and then we at least fix the default case. // https://github.com/mitsuhiko/insta/issues/473 - if color != "auto" && matches!(test_runner, TestRunner::CargoTest | TestRunner::Auto) { + if matches!(color, ColorWhen::Auto) + && matches!(test_runner, TestRunner::CargoTest | TestRunner::Auto) + { proc.arg(format!("--color={}", color)); }; Ok((proc, snapshot_ref_file, prevents_doc_run)) @@ -1107,7 +1090,7 @@ pub(crate) fn run() -> Result<(), Box> { let opts = Opts::parse_from(args); - let color = handle_color(opts.color.as_deref())?; + handle_color(opts.color); match opts.command { Command::Review(ref cmd) | Command::Accept(ref cmd) | Command::Reject(ref cmd) => { process_snapshots( @@ -1122,7 +1105,7 @@ pub(crate) fn run() -> Result<(), Box> { }, ) } - Command::Test(cmd) => test_run(cmd, color), + Command::Test(cmd) => test_run(cmd, opts.color.unwrap_or(ColorWhen::Auto)), Command::Show(cmd) => show_cmd(cmd), Command::PendingSnapshots(cmd) => pending_snapshots_cmd(cmd), } diff --git a/insta/Cargo.toml b/insta/Cargo.toml index 29372a09..55139ecd 100644 --- a/insta/Cargo.toml +++ b/insta/Cargo.toml @@ -45,7 +45,7 @@ toml = ["dep_toml", "serde"] yaml = ["serde"] # internal feature exclusive to cargo-insta -_cargo_insta_internal = [] +_cargo_insta_internal = ["clap"] [dependencies] dep_csv = { package = "csv", version = "=1.1.6", optional = true } @@ -61,6 +61,7 @@ regex = { version = "1.6.0", default-features = false, optional = true, features serde = { version = "1.0.117", optional = true } linked-hash-map = "0.5.6" lazy_static = "1.4.0" +clap = { workspace=true, optional = true } [dev-dependencies] rustc_version = "0.4.0" diff --git a/insta/src/env.rs b/insta/src/env.rs index 9bf4834e..1de2a1c0 100644 --- a/insta/src/env.rs +++ b/insta/src/env.rs @@ -25,7 +25,7 @@ pub fn get_tool_config(manifest_dir: &str) -> Arc { /// The test runner to use. #[cfg(feature = "_cargo_insta_internal")] -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, clap::ValueEnum)] pub enum TestRunner { Auto, CargoTest, @@ -46,8 +46,8 @@ pub enum OutputBehavior { } /// Unreferenced snapshots flag -#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg(feature = "_cargo_insta_internal")] +#[derive(Clone, Copy, Debug, PartialEq, Eq, clap::ValueEnum)] pub enum UnreferencedSnapshots { Auto, Reject, From 32a427f39ce72e197f34080e0ca153974a19a784 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 4 Jul 2024 17:14:39 -0700 Subject: [PATCH 03/16] Take advantage of some `clap` features Stacks on https://github.com/mitsuhiko/insta/pull/518 --- cargo-insta/src/cli.rs | 101 ++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index 2f232284..ee2902ea 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -87,8 +87,8 @@ struct TargetArgs { /// Explicit path to the workspace root #[arg(long, value_name = "PATH")] workspace_root: Option, - /// Sets the extensions to consider. Defaults to `.snap` - #[arg(short = 'e', long, value_name = "EXTENSIONS", num_args = 1.., value_delimiter = ',')] + /// Sets the extensions to consider. + #[arg(short = 'e', long, value_name = "EXTENSIONS", num_args = 1.., value_delimiter = ',', default_value = "snap")] extensions: Vec, /// Work on all packages in the workspace #[arg(long)] @@ -117,10 +117,8 @@ struct ProcessCommand { } #[derive(Args, Debug)] -#[command(rename_all = "kebab-case")] -struct TestCommand { - #[command(flatten)] - target_args: TargetArgs, +#[command(rename_all = "kebab-case", next_help_heading = "Test Runner Options")] +struct TestRunnerOptions { /// Test only this package's library unit tests #[arg(long)] lib: bool, @@ -148,12 +146,6 @@ struct TestCommand { /// Exclude packages from the test #[arg(long, value_name = "SPEC")] exclude: Option, - /// Disable force-passing of snapshot tests - #[arg(long)] - no_force_pass: bool, - /// Prevent running all tests regardless of failure - #[arg(long)] - fail_fast: bool, /// Space-separated list of features to activate #[arg(long, value_name = "FEATURES")] features: Option, @@ -178,42 +170,57 @@ struct TestCommand { /// Build for the target triple #[arg(long)] target: Option, +} + +#[derive(Args, Debug)] +#[command(rename_all = "kebab-case")] +struct TestCommand { + /// Accept all snapshots after test. + #[arg(long, conflicts_with_all = ["review", "check"])] + accept: bool, + /// Instructs the test command to just assert. + #[arg(long, conflicts_with_all = ["review"])] + check: bool, /// Follow up with review. #[arg(long)] review: bool, - /// Accept all snapshots after test. - #[arg(long, conflicts_with = "review")] - accept: bool, /// Accept all new (previously unseen). #[arg(long)] accept_unseen: bool, - /// Instructs the test command to just assert. - #[arg(long)] - check: bool, /// Do not reject pending snapshots before run. #[arg(long)] keep_pending: bool, /// Update all snapshots even if they are still matching. #[arg(long)] force_update_snapshots: bool, - /// Require metadata as well as snapshots' contents to match. - #[arg(long)] - require_full_match: bool, /// Handle unreferenced snapshots after a successful test run. #[arg(long, default_value = "ignore")] unreferenced: UnreferencedSnapshots, - /// Delete unreferenced snapshots after a successful test run. - #[arg(long, hide = true)] - delete_unreferenced_snapshots: bool, /// Filters to apply to the insta glob feature. #[arg(long)] glob_filter: Vec, + /// Require metadata as well as snapshots' contents to match. + #[arg(long)] + require_full_match: bool, + /// Prevent running all tests regardless of failure + #[arg(long)] + fail_fast: bool, /// Do not pass the quiet flag (`-q`) to tests. #[arg(short = 'Q', long)] no_quiet: bool, /// Picks the test runner. #[arg(long, default_value = "auto")] test_runner: TestRunner, + /// Delete unreferenced snapshots after a successful test run. + #[arg(long, hide = true)] + delete_unreferenced_snapshots: bool, + /// Disable force-passing of snapshot tests + #[arg(long)] + no_force_pass: bool, + #[command(flatten)] + target_args: TargetArgs, + #[command(flatten)] + test_runner_options: TestRunnerOptions, /// Options passed to cargo test #[arg(last = true)] cargo_options: Vec, @@ -362,10 +369,7 @@ fn get_find_flags(tool_config: &ToolConfig, target_args: &TargetArgs) -> FindFla } fn handle_target_args(target_args: &TargetArgs) -> Result, Box> { - let mut exts: Vec<&str> = target_args.extensions.iter().map(|x| x.as_str()).collect(); - if exts.is_empty() { - exts.push("snap"); - } + let exts: Vec<&str> = target_args.extensions.iter().map(|x| x.as_str()).collect(); // if a workspace root is provided we first check if it points to a `Cargo.toml`. If it // does we instead treat it as manifest path. If both are provided we fail with an error @@ -641,7 +645,12 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box // tests ran successfully if success { if let Some(ref path) = snapshot_ref_file { - handle_unreferenced_snapshots(path.borrow(), &loc, cmd.unreferenced, &cmd.package[..])?; + handle_unreferenced_snapshots( + path.borrow(), + &loc, + cmd.unreferenced, + &cmd.test_runner_options.package[..], + )?; } } @@ -820,42 +829,42 @@ fn prepare_test_runner<'snapshot_ref>( if cmd.target_args.all || cmd.target_args.workspace { proc.arg("--all"); } - if cmd.lib { + if cmd.test_runner_options.lib { proc.arg("--lib"); prevents_doc_run = true; } - if let Some(ref bin) = cmd.bin { + if let Some(ref bin) = cmd.test_runner_options.bin { proc.arg("--bin"); proc.arg(bin); prevents_doc_run = true; } - if cmd.bins { + if cmd.test_runner_options.bins { proc.arg("--bins"); prevents_doc_run = true; } - if let Some(ref example) = cmd.example { + if let Some(ref example) = cmd.test_runner_options.example { proc.arg("--example"); proc.arg(example); prevents_doc_run = true; } - if cmd.examples { + if cmd.test_runner_options.examples { proc.arg("--examples"); prevents_doc_run = true; } - for test in &cmd.test { + for test in &cmd.test_runner_options.test { proc.arg("--test"); proc.arg(test); prevents_doc_run = true; } - if cmd.tests { + if cmd.test_runner_options.tests { proc.arg("--tests"); prevents_doc_run = true; } - for pkg in &cmd.package { + for pkg in &cmd.test_runner_options.package { proc.arg("--package"); proc.arg(pkg); } - if let Some(ref spec) = cmd.exclude { + if let Some(ref spec) = cmd.test_runner_options.exclude { proc.arg("--exclude"); proc.arg(spec); } @@ -903,32 +912,32 @@ fn prepare_test_runner<'snapshot_ref>( if !glob_filter.is_empty() { proc.env("INSTA_GLOB_FILTER", glob_filter); } - if cmd.release { + if cmd.test_runner_options.release { proc.arg("--release"); } - if let Some(ref profile) = cmd.profile { + if let Some(ref profile) = cmd.test_runner_options.profile { proc.arg("--profile"); proc.arg(profile); } - if cmd.all_targets { + if cmd.test_runner_options.all_targets { proc.arg("--all-targets"); } - if let Some(n) = cmd.jobs { + if let Some(n) = cmd.test_runner_options.jobs { // use -j instead of --jobs since both nextest and cargo test use it proc.arg("-j"); proc.arg(n.to_string()); } - if let Some(ref features) = cmd.features { + if let Some(ref features) = cmd.test_runner_options.features { proc.arg("--features"); proc.arg(features); } - if cmd.all_features { + if cmd.test_runner_options.all_features { proc.arg("--all-features"); } - if cmd.no_default_features { + if cmd.test_runner_options.no_default_features { proc.arg("--no-default-features"); } - if let Some(ref target) = cmd.target { + if let Some(ref target) = cmd.test_runner_options.target { proc.arg("--target"); proc.arg(target); } From c89b310962a8035d3bb818dc945e81f7c3450ef1 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Sun, 30 Jun 2024 22:34:43 -0700 Subject: [PATCH 04/16] Upgrade to syn 2 Need to upgrade structopt and then we'll reduce the compile time. --- cargo-insta/Cargo.toml | 2 +- cargo-insta/src/inline.rs | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index 5ffa1f67..5d889a5b 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -20,7 +20,7 @@ structopt = { version = "0.3.26", default-features = false } serde = { version = "1.0.117", features = ["derive"] } serde_json = "1.0.59" proc-macro2 = { version = "1.0.24", features = ["span-locations"] } -syn = { version = "1.0.50", features = ["full", "visit", "extra-traits"] } +syn = { version = "2.0.0", features = ["full", "visit", "extra-traits"] } ignore = "0.4.17" uuid = { version = "1.0.0", features = ["v4"] } tempfile = "3.5.0" diff --git a/cargo-insta/src/inline.rs b/cargo-insta/src/inline.rs index 803fcc37..77b73a7e 100644 --- a/cargo-insta/src/inline.rs +++ b/cargo-insta/src/inline.rs @@ -7,6 +7,7 @@ use std::path::{Path, PathBuf}; use insta::_cargo_insta_support::SnapshotContents; use proc_macro2::TokenTree; +use syn::__private::ToTokens; use syn::spanned::Spanned; #[derive(Debug)] @@ -213,21 +214,17 @@ impl FilePatcher { impl<'ast> syn::visit::Visit<'ast> for Visitor { fn visit_attribute(&mut self, i: &'ast syn::Attribute) { let start = i.span().start().line; - let end = i - .tokens - .clone() - .into_iter() - .last() - .map_or(start, |t| t.span().end().line); + let end = i.span().end().line; - if start > self.0 || end < self.0 || i.path.segments.is_empty() { + if start > self.0 || end < self.0 || i.path().segments.is_empty() { return; } - let tokens: Vec<_> = i.tokens.clone().into_iter().collect(); - self.scan_nested_macros(&tokens); + let tokens: Vec<_> = i.meta.to_token_stream().into_iter().collect(); + if !tokens.is_empty() { + self.scan_nested_macros(&tokens); + } } - fn visit_macro(&mut self, i: &'ast syn::Macro) { let indentation = i.span().start().column; let start = i.span().start().line; From 037023005a0a15dd1794bd915e7e88fd9c6ce9e6 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Sun, 7 Jul 2024 13:34:54 -0700 Subject: [PATCH 05/16] --- cargo-insta/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index 5d889a5b..fe183652 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -19,7 +19,7 @@ console = "0.15.4" structopt = { version = "0.3.26", default-features = false } serde = { version = "1.0.117", features = ["derive"] } serde_json = "1.0.59" -proc-macro2 = { version = "1.0.24", features = ["span-locations"] } +proc-macro2 = { version = "1.0.60", features = ["span-locations"] } syn = { version = "2.0.0", features = ["full", "visit", "extra-traits"] } ignore = "0.4.17" uuid = { version = "1.0.0", features = ["v4"] } From 7d1e176d9fce1192c110b081257121acaba0b849 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Sun, 7 Jul 2024 13:51:27 -0700 Subject: [PATCH 06/16] Bump `cargo-insta` toolchaine to 1.64 (leaves `insta` at 1.51) --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ad6849c0..9e4c10bb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,14 +22,14 @@ jobs: run: make test test-stable: - name: Test on 1.61.0 + name: Test on 1.64.0 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.61.0 + toolchain: 1.64.0 - uses: Swatinem/rust-cache@v2 - name: Use Cargo.lock.msrv run: cp Cargo.lock.msrv Cargo.lock From f3cbd5bb88dc1603d870e2383a9c590342566dcc Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Tue, 30 Jul 2024 20:44:06 -0700 Subject: [PATCH 07/16] Fix `test_runner` in config This was previously ignored. Stacks on #521 to avoid conflicts; merge that first --- cargo-insta/src/cli.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index b621b916..037485dc 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -610,8 +610,14 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box cmd.unreferenced = UnreferencedSnapshots::Delete; } + let test_runner = match cmd.test_runner { + TestRunner::Auto => loc.tool_config.test_runner(), + TestRunner::CargoTest => TestRunner::CargoTest, + TestRunner::Nextest => TestRunner::Nextest, + }; + let (mut proc, snapshot_ref_file, prevents_doc_run) = - prepare_test_runner(cmd.test_runner, cmd.unreferenced, &cmd, color, &[], None)?; + prepare_test_runner(test_runner, cmd.unreferenced, &cmd, color, &[], None)?; if !cmd.keep_pending { process_snapshots(true, None, &loc, Some(Operation::Reject))?; From eacbefa82f797ddac771b4af8e366a15f4b19c78 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Tue, 30 Jul 2024 20:45:56 -0700 Subject: [PATCH 08/16] --- cargo-insta/src/cli.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index 037485dc..6b4c1a35 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -610,6 +610,7 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box cmd.unreferenced = UnreferencedSnapshots::Delete; } + // Prioritize the command line over the tool config let test_runner = match cmd.test_runner { TestRunner::Auto => loc.tool_config.test_runner(), TestRunner::CargoTest => TestRunner::CargoTest, From 169a57dbaafee7def0a89ff40e2305af279bba6f Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Tue, 30 Jul 2024 20:53:35 -0700 Subject: [PATCH 09/16] . --- cargo-insta/src/cli.rs | 6 ++++++ insta/src/env.rs | 18 ++++++++++++++++++ insta/src/lib.rs | 3 +++ 3 files changed, 27 insertions(+) diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index 6b4c1a35..c67da211 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -211,6 +211,8 @@ struct TestCommand { /// Picks the test runner. #[arg(long, default_value = "auto")] test_runner: TestRunner, + #[arg(long)] + test_runner_fallback: Option, /// Delete unreferenced snapshots after a successful test run. #[arg(long, hide = true)] delete_unreferenced_snapshots: bool, @@ -616,6 +618,10 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box TestRunner::CargoTest => TestRunner::CargoTest, TestRunner::Nextest => TestRunner::Nextest, }; + // Prioritize the command line over the tool config + let test_runner_fallback = cmd + .test_runner_fallback + .unwrap_or(loc.tool_config.test_runner_fallback()); let (mut proc, snapshot_ref_file, prevents_doc_run) = prepare_test_runner(test_runner, cmd.unreferenced, &cmd, color, &[], None)?; diff --git a/insta/src/env.rs b/insta/src/env.rs index 1de2a1c0..9082b120 100644 --- a/insta/src/env.rs +++ b/insta/src/env.rs @@ -104,6 +104,8 @@ pub struct ToolConfig { #[cfg(feature = "glob")] glob_fail_fast: bool, #[cfg(feature = "_cargo_insta_internal")] + test_runner_fallback: bool, + #[cfg(feature = "_cargo_insta_internal")] test_runner: TestRunner, #[cfg(feature = "_cargo_insta_internal")] test_unreferenced: UnreferencedSnapshots, @@ -235,6 +237,15 @@ impl ToolConfig { .map_err(|_| Error::Env("INSTA_TEST_RUNNER"))? }, #[cfg(feature = "_cargo_insta_internal")] + test_runner_fallback: match env::var("INSTA_TEST_RUNNER_FALLBACK").as_deref() { + Err(_) | Ok("") => resolve(&cfg, &["test", "runner_fallback"]) + .and_then(|x| x.as_bool()) + .unwrap_or(false), + Ok("1") => true, + Ok("0") => false, + _ => return Err(Error::Env("INSTA_RUNNER_FALLBACK")), + }, + #[cfg(feature = "_cargo_insta_internal")] test_unreferenced: { resolve(&cfg, &["test", "unreferenced"]) .and_then(|x| x.as_str()) @@ -265,6 +276,8 @@ impl ToolConfig { }) } + // TODO: Do we want all these methods, vs. just allowing access to the fields? + /// Is insta told to force update snapshots? pub fn force_update_snapshots(&self) -> bool { self.force_update_snapshots @@ -304,6 +317,11 @@ impl ToolConfig { self.test_runner } + /// Whether to fallback to `cargo test` if the test runner isn't available + pub fn test_runner_fallback(&self) -> bool { + self.test_runner_fallback + } + pub fn test_unreferenced(&self) -> UnreferencedSnapshots { self.test_unreferenced } diff --git a/insta/src/lib.rs b/insta/src/lib.rs index 98205158..a15057ac 100644 --- a/insta/src/lib.rs +++ b/insta/src/lib.rs @@ -232,6 +232,9 @@ //! test: //! # also set by INSTA_TEST_RUNNER //! runner: "auto" | "cargo-test" | "nextest" +//! # whether to fallback to `cargo-test` if `nextest` is not available, +//! # also set by INSTA_TEST_RUNNER_FALLBACK, default false +//! test_runner_fallback: true/false //! # automatically assume --review was passed to cargo insta test //! auto_review: true/false //! # automatically assume --accept-unseen was passed to cargo insta test From 9ac7b0efa716ddac1c59582df69e6b216c2fee43 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Tue, 30 Jul 2024 20:58:03 -0700 Subject: [PATCH 10/16] Add an option to fall back to `cargo test` This allows a project to default to `nextest` in its insta config, while falling back to `cargo test` when that isn't available. Stacks on https://github.com/mitsuhiko/insta/pull/544 Needs an integration test, will add when #537 merges --- cargo-insta/src/cli.rs | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index c67da211..dde65bd1 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -623,8 +623,15 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box .test_runner_fallback .unwrap_or(loc.tool_config.test_runner_fallback()); - let (mut proc, snapshot_ref_file, prevents_doc_run) = - prepare_test_runner(test_runner, cmd.unreferenced, &cmd, color, &[], None)?; + let (mut proc, snapshot_ref_file, prevents_doc_run) = prepare_test_runner( + test_runner, + test_runner_fallback, + cmd.unreferenced, + &cmd, + color, + &[], + None, + )?; if !cmd.keep_pending { process_snapshots(true, None, &loc, Some(Operation::Reject))?; @@ -637,6 +644,7 @@ fn test_run(mut cmd: TestCommand, color: ColorWhen) -> Result<(), Box if matches!(cmd.test_runner, TestRunner::Nextest) && !prevents_doc_run { let (mut proc, _, _) = prepare_test_runner( TestRunner::CargoTest, + false, cmd.unreferenced, &cmd, color, @@ -802,6 +810,7 @@ fn handle_unreferenced_snapshots( #[allow(clippy::type_complexity)] fn prepare_test_runner<'snapshot_ref>( test_runner: TestRunner, + test_runner_fallback: bool, unreferenced: UnreferencedSnapshots, cmd: &TestCommand, color: ColorWhen, @@ -812,6 +821,26 @@ fn prepare_test_runner<'snapshot_ref>( let cargo = cargo .as_deref() .unwrap_or_else(|| std::ffi::OsStr::new("cargo")); + let test_runner = match test_runner { + TestRunner::CargoTest | TestRunner::Auto => test_runner, + TestRunner::Nextest => { + // Fall back to `cargo test` if `cargo nextest` isn't installed and + // `test_runner_fallback` is true (but don't run the cargo command + // unless that's an option) + if !test_runner_fallback + || std::process::Command::new("cargo") + .arg("nextest") + .arg("--version") + .output() + .map(|output| output.status.success()) + .unwrap_or(false) + { + TestRunner::Nextest + } else { + TestRunner::Auto + } + } + }; let mut proc = match test_runner { TestRunner::CargoTest | TestRunner::Auto => { let mut proc = process::Command::new(cargo); From 5df91c66a47bf9b1cedf2b4c55b3b39d78519ece Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 1 Aug 2024 13:45:51 +0200 Subject: [PATCH 11/16] Update Cargo.toml --- cargo-insta/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index bd55bb1e..e3fd3fa8 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["snapshot", "testing", "jest"] categories = ["development-tools::cargo-plugins"] edition = "2018" readme = "README.md" -rust-version = "1.61.0" +rust-version = "1.64.0" [dependencies] insta = { version = "=1.39.0", path = "../insta", features = ["json", "yaml", "redactions", "_cargo_insta_internal"] } From 60d8b4b89185db591c014af16066e5c32b10c0bb Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 1 Aug 2024 10:53:39 -0700 Subject: [PATCH 12/16] cargo.lock merge --- Cargo.lock | 263 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 195 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 070391e2..ce987b8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,55 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "base64" version = "0.13.1" @@ -58,14 +107,14 @@ name = "cargo-insta" version = "1.39.0" dependencies = [ "cargo_metadata", + "clap", "console", "ignore", "insta", "proc-macro2", "serde", "serde_json", - "structopt", - "syn", + "syn 2.0.72", "tempfile", "uuid", "walkdir", @@ -108,15 +157,50 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.34.0" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ - "bitflags", - "textwrap", - "unicode-width", + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.72", ] +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + [[package]] name = "console" version = "0.15.4" @@ -269,12 +353,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -304,6 +385,7 @@ dependencies = [ name = "insta" version = "1.39.0" dependencies = [ + "clap", "console", "csv", "globset", @@ -341,6 +423,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itoa" version = "0.4.8" @@ -428,7 +516,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -442,44 +530,20 @@ dependencies = [ "sha1", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -591,7 +655,7 @@ checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -637,34 +701,27 @@ dependencies = [ ] [[package]] -name = "structopt" -version = "0.3.26" +name = "strsim" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "structopt-derive" -version = "0.4.18" +name = "syn" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ - "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "unicode-ident", ] [[package]] name = "syn" -version = "1.0.99" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -684,15 +741,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.35" @@ -710,7 +758,7 @@ checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -761,6 +809,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.1.2" @@ -857,6 +911,15 @@ dependencies = [ "windows-targets 0.48.0", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -887,6 +950,22 @@ dependencies = [ "windows_x86_64_msvc 0.48.0", ] +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -899,6 +978,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -911,6 +996,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -923,6 +1014,18 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -935,6 +1038,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -947,6 +1056,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -959,6 +1074,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -970,3 +1091,9 @@ name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" From 86d8f4e5bcb8cff79ee62a17a450254540842942 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 1 Aug 2024 11:28:33 -0700 Subject: [PATCH 13/16] --- cargo-insta/Cargo.toml | 4 +++- insta/Cargo.toml | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index 9089de29..29beee55 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -25,7 +25,9 @@ syn = { version = "=2.0.8", features = ["full", "visit", "extra-traits"] } ignore = "0.4.17" uuid = { version = "1.0.0", features = ["v4"] } tempfile = "3.5.0" -clap = { workspace=true} +# Not yet supported in our MSRV of 1.60.0 +# clap = { workspace=true } +clap = {version = "4.0", features = ["derive", "env"]} [dev-dependencies] walkdir = "2.3.1" diff --git a/insta/Cargo.toml b/insta/Cargo.toml index 9a384856..0e9ffce9 100644 --- a/insta/Cargo.toml +++ b/insta/Cargo.toml @@ -5,7 +5,7 @@ license = "Apache-2.0" authors = ["Armin Ronacher "] description = "A snapshot testing library for Rust" edition = "2018" -rust-version = "1.57.0" +rust-version = "1.60.0" homepage = "https://insta.rs/" repository = "https://github.com/mitsuhiko/insta" keywords = ["snapshot", "testing", "jest", "approval"] @@ -61,7 +61,9 @@ regex = { version = "1.6.0", default-features = false, optional = true, features serde = { version = "1.0.117", optional = true } linked-hash-map = "0.5.6" lazy_static = "1.4.0" -clap = { workspace=true, optional = true } +# Not yet supported in our MSRV of 1.60.0 +# clap = { workspace=true, optional = true } +clap = {version = "4.0", features = ["derive", "env"], optional = true} [dev-dependencies] rustc_version = "0.4.0" From 169e89962013a732532180f891dd11812748619f Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 1 Aug 2024 11:31:58 -0700 Subject: [PATCH 14/16] --- .github/workflows/tests.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 69b65e27..5ff724b8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,19 +26,6 @@ jobs: - name: Test run: make test - test-stable: - name: Test on 1.64.0 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: 1.64.0 - - uses: Swatinem/rust-cache@v2 - - name: Test - run: cargo run -p cargo-insta -- test - test-current-cargo-insta: name: Run the in-tree version of cargo-insta on ourselves runs-on: ubuntu-latest @@ -52,7 +39,7 @@ jobs: - name: Test run: cargo run -p cargo-insta -- test - build-old-stable: + build-on-msrv: name: Check on MSRV runs-on: ubuntu-latest steps: From 71e0eb16841bcfb9eee32cb234cf13ec6b62d9ad Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 1 Aug 2024 12:13:35 -0700 Subject: [PATCH 15/16] --- Cargo.lock | 111 ++++++++++++----------------------------- Cargo.toml | 3 +- cargo-insta/Cargo.toml | 3 +- insta/Cargo.toml | 2 +- 4 files changed, 38 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85afc53a..24ef9f15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,55 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anstream" -version = "0.6.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" - -[[package]] -name = "anstyle-parse" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "base64" version = "0.13.1" @@ -157,31 +108,33 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.13" +version = "4.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" +checksum = "906f7fe1da4185b7a282b2bc90172a496f9def1aca4545fe7526810741591e14" dependencies = [ "clap_builder", "clap_derive", + "once_cell", ] [[package]] name = "clap_builder" -version = "4.5.13" +version = "4.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +checksum = "351f9ad9688141ed83dfd8f5fb998a06225ef444b48ff4dc43de6d409b7fd10b" dependencies = [ - "anstream", - "anstyle", + "bitflags", "clap_lex", + "is-terminal", "strsim", + "termcolor", ] [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "81d7dc0031c3a59a04fc2ba395c8e2dd463cba1859275f065d225f6122221b45" dependencies = [ "heck", "proc-macro2", @@ -191,15 +144,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" - -[[package]] -name = "colorchoice" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] name = "console" @@ -353,9 +300,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.5.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -424,10 +371,15 @@ dependencies = [ ] [[package]] -name = "is_terminal_polyfill" -version = "1.70.1" +name = "is-terminal" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.52.0", +] [[package]] name = "itoa" @@ -702,9 +654,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.11.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -741,6 +693,15 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.35" @@ -809,12 +770,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "uuid" version = "1.1.2" diff --git a/Cargo.toml b/Cargo.toml index 364bbaaa..bc50bca1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,5 @@ inherits = "release" lto = "thin" [workspace.dependencies] -clap = {version = "4.3", features = ["derive", "env"]} +# Locking because of MSRV; wait for MSRV bump or msrv-resolver +clap = {version = "4.1", features = ["derive", "env"]} diff --git a/cargo-insta/Cargo.toml b/cargo-insta/Cargo.toml index 29beee55..19e30b5d 100644 --- a/cargo-insta/Cargo.toml +++ b/cargo-insta/Cargo.toml @@ -27,7 +27,8 @@ uuid = { version = "1.0.0", features = ["v4"] } tempfile = "3.5.0" # Not yet supported in our MSRV of 1.60.0 # clap = { workspace=true } -clap = {version = "4.0", features = ["derive", "env"]} +clap = {version = "=4.1", features = ["derive", "env"]} + [dev-dependencies] walkdir = "2.3.1" diff --git a/insta/Cargo.toml b/insta/Cargo.toml index 0e9ffce9..5d7ae7d2 100644 --- a/insta/Cargo.toml +++ b/insta/Cargo.toml @@ -63,7 +63,7 @@ linked-hash-map = "0.5.6" lazy_static = "1.4.0" # Not yet supported in our MSRV of 1.60.0 # clap = { workspace=true, optional = true } -clap = {version = "4.0", features = ["derive", "env"], optional = true} +clap = {version = "=4.1", features = ["derive", "env"], optional = true} [dev-dependencies] rustc_version = "0.4.0" From def2e956ebaedcf058de79c1ea008177e4b4dab4 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 1 Aug 2024 12:21:18 -0700 Subject: [PATCH 16/16] --- Cargo.lock | 66 +++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24ef9f15..5328a1fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,7 @@ dependencies = [ "proc-macro2", "serde", "serde_json", - "syn 2.0.8", + "syn", "tempfile", "uuid", "walkdir", @@ -139,7 +139,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.8", + "syn", ] [[package]] @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -440,19 +440,20 @@ checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" [[package]] name = "pest" -version = "2.3.1" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.3.1" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502b62a6d0245378b04ffe0a7fb4f4419a4815fce813bd8a0ec89a56e07d67b1" +checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" dependencies = [ "pest", "pest_generator", @@ -460,26 +461,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.3.1" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451e629bf49b750254da26132f1a5a9d11fd8a95a3df51d15c4abd1ba154cb6c" +checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 1.0.99", + "syn", ] [[package]] name = "pest_meta" -version = "2.3.1" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec162c71c45e269dfc3fc2916eaeb97feab22993a21bcce4721d08cd7801a6" +checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" dependencies = [ "once_cell", "pest", - "sha1", + "sha2", ] [[package]] @@ -592,22 +593,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.144" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 1.0.99", + "syn", ] [[package]] @@ -622,10 +623,10 @@ dependencies = [ ] [[package]] -name = "sha1" -version = "0.10.5" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -658,17 +659,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "syn" -version = "1.0.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.8" @@ -704,22 +694,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 1.0.99", + "syn", ] [[package]]