From 72e66fb645900a95bc637909d2d092d032657470 Mon Sep 17 00:00:00 2001 From: alcolmenar Date: Wed, 9 Aug 2023 15:57:34 -0700 Subject: [PATCH] fix: add quiet verbosity around resolve and fix tests --- src/bin/cargo/commands/remove.rs | 12 +++++++++++- .../cargo_remove/avoid_empty_tables/stderr.log | 1 - tests/testsuite/cargo_remove/build/stderr.log | 1 - tests/testsuite/cargo_remove/dev/stderr.log | 1 - .../cargo_remove/gc_keep_used_patch/stderr.log | 1 - tests/testsuite/cargo_remove/gc_patch/stderr.log | 7 ------- tests/testsuite/cargo_remove/gc_profile/stderr.log | 1 - tests/testsuite/cargo_remove/gc_replace/stderr.log | 1 - .../testsuite/cargo_remove/multiple_deps/stderr.log | 1 - tests/testsuite/cargo_remove/multiple_dev/stderr.log | 1 - .../cargo_remove/optional_dep_feature/stderr.log | 1 - .../cargo_remove/optional_feature/stderr.log | 1 - tests/testsuite/cargo_remove/package/stderr.log | 1 - tests/testsuite/cargo_remove/remove_basic/stderr.log | 1 - tests/testsuite/cargo_remove/target/stderr.log | 1 - tests/testsuite/cargo_remove/target_build/stderr.log | 1 - tests/testsuite/cargo_remove/target_dev/stderr.log | 1 - .../cargo_remove/update_lock_file/stderr.log | 1 - tests/testsuite/cargo_remove/workspace/stderr.log | 1 - .../cargo_remove/workspace_non_virtual/stderr.log | 1 - .../cargo_remove/workspace_preserved/stderr.log | 1 - 21 files changed, 11 insertions(+), 27 deletions(-) diff --git a/src/bin/cargo/commands/remove.rs b/src/bin/cargo/commands/remove.rs index 06aa5858d3a..02dc8406b26 100644 --- a/src/bin/cargo/commands/remove.rs +++ b/src/bin/cargo/commands/remove.rs @@ -110,7 +110,17 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { // Reload the workspace since we've changed dependencies let ws = args.workspace(config)?; - let (_, resolve) = resolve_ws(&ws)?; + let resolve = { + // HACK: Avoid unused patch warnings by temporarily changing the verbosity. + // In rare cases, this might cause index update messages to not show up + let verbosity = ws.config().shell().verbosity(); + ws.config() + .shell() + .set_verbosity(cargo::core::Verbosity::Quiet); + let resolve = resolve_ws(&ws); + ws.config().shell().set_verbosity(verbosity); + resolve?.1 + }; // Attempt to gc unused patches and re-resolve if anything is removed if gc_unused_patches(&workspace, &resolve)? { diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log b/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log index dd71023a864..486ef359fe2 100644 --- a/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log @@ -1,2 +1 @@ Removing clippy from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/build/stderr.log b/tests/testsuite/cargo_remove/build/stderr.log index f037ebe28ce..a51bea48c9e 100644 --- a/tests/testsuite/cargo_remove/build/stderr.log +++ b/tests/testsuite/cargo_remove/build/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/dev/stderr.log b/tests/testsuite/cargo_remove/dev/stderr.log index c629b26b19d..ccabdb193d4 100644 --- a/tests/testsuite/cargo_remove/dev/stderr.log +++ b/tests/testsuite/cargo_remove/dev/stderr.log @@ -1,2 +1 @@ Removing regex from dev-dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log b/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log index abbc07834bb..b4377b3a4b5 100644 --- a/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log +++ b/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log @@ -1,2 +1 @@ Removing serde_derive from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/gc_patch/stderr.log b/tests/testsuite/cargo_remove/gc_patch/stderr.log index 2c966e9df3f..ba519ba1b91 100644 --- a/tests/testsuite/cargo_remove/gc_patch/stderr.log +++ b/tests/testsuite/cargo_remove/gc_patch/stderr.log @@ -1,8 +1 @@ Removing bar from dependencies - Updating git repository `[ROOTURL]/bar[..]` - Updating git repository `[ROOTURL]/bar[..]` - Updating `dummy-registry` index -warning: Patch `bar v0.1.0 ([..])` was not used in the crate graph. -Perhaps you misspelled the source URL being patched. -Possible URLs for `[patch.]`: - [ROOT]/bar2 diff --git a/tests/testsuite/cargo_remove/gc_profile/stderr.log b/tests/testsuite/cargo_remove/gc_profile/stderr.log index 0e2e38f266e..9dee9e2b713 100644 --- a/tests/testsuite/cargo_remove/gc_profile/stderr.log +++ b/tests/testsuite/cargo_remove/gc_profile/stderr.log @@ -1,2 +1 @@ Removing toml from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/gc_replace/stderr.log b/tests/testsuite/cargo_remove/gc_replace/stderr.log index 0e2e38f266e..9dee9e2b713 100644 --- a/tests/testsuite/cargo_remove/gc_replace/stderr.log +++ b/tests/testsuite/cargo_remove/gc_replace/stderr.log @@ -1,2 +1 @@ Removing toml from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/multiple_deps/stderr.log b/tests/testsuite/cargo_remove/multiple_deps/stderr.log index 1eb59aca1b7..111b1e94acd 100644 --- a/tests/testsuite/cargo_remove/multiple_deps/stderr.log +++ b/tests/testsuite/cargo_remove/multiple_deps/stderr.log @@ -1,3 +1,2 @@ Removing docopt from dependencies Removing semver from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/multiple_dev/stderr.log b/tests/testsuite/cargo_remove/multiple_dev/stderr.log index a3042dcc3cd..8a69c94f55c 100644 --- a/tests/testsuite/cargo_remove/multiple_dev/stderr.log +++ b/tests/testsuite/cargo_remove/multiple_dev/stderr.log @@ -1,3 +1,2 @@ Removing regex from dev-dependencies Removing serde from dev-dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log b/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log index 72c9f92172d..d3656ec540e 100644 --- a/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log +++ b/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log @@ -1,2 +1 @@ Removing serde from dev-dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/optional_feature/stderr.log b/tests/testsuite/cargo_remove/optional_feature/stderr.log index 2dc546fa718..ef7354ef183 100644 --- a/tests/testsuite/cargo_remove/optional_feature/stderr.log +++ b/tests/testsuite/cargo_remove/optional_feature/stderr.log @@ -1,2 +1 @@ Removing semver from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/package/stderr.log b/tests/testsuite/cargo_remove/package/stderr.log index 231026f2bf6..7083976b17d 100644 --- a/tests/testsuite/cargo_remove/package/stderr.log +++ b/tests/testsuite/cargo_remove/package/stderr.log @@ -1,2 +1 @@ Removing docopt from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/remove_basic/stderr.log b/tests/testsuite/cargo_remove/remove_basic/stderr.log index 231026f2bf6..7083976b17d 100644 --- a/tests/testsuite/cargo_remove/remove_basic/stderr.log +++ b/tests/testsuite/cargo_remove/remove_basic/stderr.log @@ -1,2 +1 @@ Removing docopt from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/target/stderr.log b/tests/testsuite/cargo_remove/target/stderr.log index 810abd994d9..8fb1b5000b8 100644 --- a/tests/testsuite/cargo_remove/target/stderr.log +++ b/tests/testsuite/cargo_remove/target/stderr.log @@ -1,2 +1 @@ Removing dbus from dependencies for target `x86_64-unknown-linux-gnu` - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/target_build/stderr.log b/tests/testsuite/cargo_remove/target_build/stderr.log index b06f8f319c5..673a47cebd2 100644 --- a/tests/testsuite/cargo_remove/target_build/stderr.log +++ b/tests/testsuite/cargo_remove/target_build/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies for target `x86_64-unknown-linux-gnu` - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/target_dev/stderr.log b/tests/testsuite/cargo_remove/target_dev/stderr.log index 68553a3bdce..854aff44a77 100644 --- a/tests/testsuite/cargo_remove/target_dev/stderr.log +++ b/tests/testsuite/cargo_remove/target_dev/stderr.log @@ -1,2 +1 @@ Removing ncurses from dev-dependencies for target `x86_64-unknown-linux-gnu` - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/update_lock_file/stderr.log b/tests/testsuite/cargo_remove/update_lock_file/stderr.log index 164f8f4b979..1494b0fc579 100644 --- a/tests/testsuite/cargo_remove/update_lock_file/stderr.log +++ b/tests/testsuite/cargo_remove/update_lock_file/stderr.log @@ -1,2 +1 @@ Removing rustc-serialize from dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/workspace/stderr.log b/tests/testsuite/cargo_remove/workspace/stderr.log index f037ebe28ce..a51bea48c9e 100644 --- a/tests/testsuite/cargo_remove/workspace/stderr.log +++ b/tests/testsuite/cargo_remove/workspace/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log b/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log index f037ebe28ce..a51bea48c9e 100644 --- a/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log +++ b/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/workspace_preserved/stderr.log b/tests/testsuite/cargo_remove/workspace_preserved/stderr.log index f037ebe28ce..a51bea48c9e 100644 --- a/tests/testsuite/cargo_remove/workspace_preserved/stderr.log +++ b/tests/testsuite/cargo_remove/workspace_preserved/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index