From 090064cc148e998aa6b35aedafbb8fe964ccc4e7 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 12 Jul 2024 00:23:33 -0500 Subject: [PATCH 1/3] feat(test): Add cargo_test to test-support prelude --- crates/cargo-test-support/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs index 5146f9b84d8..9f6d12077f9 100644 --- a/crates/cargo-test-support/src/lib.rs +++ b/crates/cargo-test-support/src/lib.rs @@ -73,6 +73,7 @@ pub mod registry; pub mod tools; pub mod prelude { + pub use crate::cargo_test; pub use crate::ArgLine; pub use crate::CargoCommand; pub use crate::ChannelChanger; From 5b9799c6f478955241798eeb18ac72b904d246ec Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 12 Jul 2024 00:22:40 -0500 Subject: [PATCH 2/3] refactor: Migrate from `extern crate` to test-support prelude We now include the prelude in so many places, this simplifies how we can present how `cargo-test-support` works. Yes, this included some `use` clean ups but its already painful enough walking through every test file, I didn't want to do it twice. --- Cargo.lock | 1 - Cargo.toml | 1 - tests/build-std/main.rs | 2 +- tests/testsuite/advanced_env.rs | 1 + tests/testsuite/alt_registry.rs | 3 ++- tests/testsuite/artifact_dir.rs | 7 ++++--- tests/testsuite/build.rs | 9 +++++---- tests/testsuite/build_script.rs | 9 +++++---- tests/testsuite/build_script_env.rs | 1 + .../testsuite/build_script_extra_link_arg.rs | 1 + tests/testsuite/cache_lock.rs | 7 +++++-- tests/testsuite/cache_messages.rs | 4 +++- tests/testsuite/cargo_alias_config.rs | 1 + .../cargo_bench/no_keep_going/mod.rs | 1 + tests/testsuite/cargo_command.rs | 1 + tests/testsuite/cargo_env_config.rs | 1 + tests/testsuite/cargo_features.rs | 1 + .../inherit_workspace_package_table/mod.rs | 1 + .../testsuite/cargo_init/reserved_name/mod.rs | 3 ++- .../add_members_to_non_workspace/mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + tests/testsuite/cargo_new/empty_name/mod.rs | 1 + .../cargo_new/inherit_workspace_lints/mod.rs | 1 + .../inherit_workspace_package_table/mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../mod.rs | 1 + .../cargo_remove/avoid_empty_tables/mod.rs | 1 + tests/testsuite/cargo_remove/build/mod.rs | 1 + tests/testsuite/cargo_remove/dev/mod.rs | 1 + tests/testsuite/cargo_remove/dry_run/mod.rs | 1 + .../cargo_remove/gc_keep_used_patch/mod.rs | 1 + tests/testsuite/cargo_remove/gc_patch/mod.rs | 1 + .../testsuite/cargo_remove/gc_profile/mod.rs | 1 + .../testsuite/cargo_remove/gc_replace/mod.rs | 1 + .../testsuite/cargo_remove/invalid_arg/mod.rs | 1 + .../testsuite/cargo_remove/invalid_dep/mod.rs | 1 + .../cargo_remove/invalid_package/mod.rs | 1 + .../invalid_package_multiple/mod.rs | 1 + .../cargo_remove/invalid_section/mod.rs | 1 + .../cargo_remove/invalid_section_dep/mod.rs | 1 + .../cargo_remove/invalid_target/mod.rs | 1 + .../cargo_remove/invalid_target_dep/mod.rs | 1 + .../cargo_remove/multiple_deps/mod.rs | 1 + .../cargo_remove/multiple_dev/mod.rs | 1 + tests/testsuite/cargo_remove/no_arg/mod.rs | 1 + tests/testsuite/cargo_remove/offline/mod.rs | 1 + .../cargo_remove/optional_dep_feature/mod.rs | 1 + .../optional_dep_feature_formatting/mod.rs | 1 + .../cargo_remove/optional_feature/mod.rs | 1 + tests/testsuite/cargo_remove/package/mod.rs | 1 + .../cargo_remove/remove_basic/mod.rs | 1 + .../cargo_remove/skip_gc_glob_profile/mod.rs | 1 + tests/testsuite/cargo_remove/target/mod.rs | 1 + .../cargo_remove/target_build/mod.rs | 1 + .../testsuite/cargo_remove/target_dev/mod.rs | 1 + .../cargo_remove/update_lock_file/mod.rs | 1 + tests/testsuite/cargo_remove/workspace/mod.rs | 1 + .../cargo_remove/workspace_non_virtual/mod.rs | 1 + .../cargo_remove/workspace_preserved/mod.rs | 1 + tests/testsuite/cargo_targets.rs | 1 + .../testsuite/cargo_test/no_keep_going/mod.rs | 1 + tests/testsuite/cfg.rs | 1 + tests/testsuite/concurrent.rs | 1 + tests/testsuite/config.rs | 13 +++++++------ tests/testsuite/config_cli.rs | 11 +++++++---- tests/testsuite/config_include.rs | 4 +++- tests/testsuite/corrupt_git.rs | 6 ++++-- tests/testsuite/credential_process.rs | 1 + tests/testsuite/cross_publish.rs | 1 + tests/testsuite/custom_target.rs | 4 +++- tests/testsuite/death.rs | 4 +++- tests/testsuite/dep_info.rs | 8 +++++--- tests/testsuite/diagnostics.rs | 1 + tests/testsuite/direct_minimal_versions.rs | 1 + tests/testsuite/directory.rs | 4 ++-- tests/testsuite/doc.rs | 5 +++-- tests/testsuite/edition.rs | 1 + tests/testsuite/error.rs | 1 + tests/testsuite/features2.rs | 3 ++- tests/testsuite/features_namespaced.rs | 3 ++- tests/testsuite/fetch.rs | 1 + tests/testsuite/fix_n_times.rs | 5 +++-- tests/testsuite/freshness.rs | 7 ++++--- tests/testsuite/future_incompat_report.rs | 4 +++- tests/testsuite/generate_lockfile.rs | 5 +++-- tests/testsuite/git.rs | 1 + tests/testsuite/git_auth.rs | 1 + tests/testsuite/git_gc.rs | 2 +- tests/testsuite/git_shallow.rs | 4 +++- tests/testsuite/global_cache_tracker.rs | 19 +++++++++++-------- tests/testsuite/help.rs | 8 +++++--- tests/testsuite/https.rs | 1 + tests/testsuite/install.rs | 4 ++-- tests/testsuite/install_upgrade.rs | 3 ++- tests/testsuite/jobserver.rs | 3 ++- tests/testsuite/lints/implicit_features.rs | 1 + tests/testsuite/lints/mod.rs | 1 + tests/testsuite/lints/unknown_lints.rs | 1 + .../lints/unused_optional_dependencies.rs | 1 + tests/testsuite/lints_table.rs | 1 + tests/testsuite/list_availables.rs | 1 + tests/testsuite/local_registry.rs | 3 ++- tests/testsuite/lockfile_compat.rs | 1 + tests/testsuite/login.rs | 6 ++++-- tests/testsuite/logout.rs | 1 + tests/testsuite/lto.rs | 3 ++- tests/testsuite/main.rs | 5 ++--- tests/testsuite/member_discovery.rs | 2 +- tests/testsuite/member_errors.rs | 2 +- tests/testsuite/message_format.rs | 1 + tests/testsuite/messages.rs | 1 + tests/testsuite/metabuild.rs | 4 ++-- tests/testsuite/minimal_versions.rs | 1 + tests/testsuite/net_config.rs | 1 + tests/testsuite/new.rs | 6 ++++-- tests/testsuite/offline.rs | 4 +++- tests/testsuite/old_cargos.rs | 4 +++- tests/testsuite/owner.rs | 1 + tests/testsuite/package.rs | 5 +++-- tests/testsuite/package_features.rs | 6 ++++-- tests/testsuite/patch.rs | 3 ++- tests/testsuite/path.rs | 4 +++- tests/testsuite/paths.rs | 1 + tests/testsuite/precise_pre_release.rs | 1 + tests/testsuite/profile_trim_paths.rs | 1 + tests/testsuite/profiles.rs | 3 ++- tests/testsuite/publish.rs | 6 ++++-- tests/testsuite/registry.rs | 11 ++++++----- tests/testsuite/registry_auth.rs | 1 + tests/testsuite/registry_overlay.rs | 1 + tests/testsuite/rename_deps.rs | 1 + tests/testsuite/replace.rs | 1 + tests/testsuite/required_features.rs | 1 + tests/testsuite/run.rs | 1 + tests/testsuite/rustc_info_cache.rs | 4 +++- tests/testsuite/rustdoc.rs | 1 + tests/testsuite/rustdoc_extern_html.rs | 1 + tests/testsuite/rustdocflags.rs | 1 + tests/testsuite/rustflags.rs | 4 +++- tests/testsuite/rustup.rs | 6 ++++-- tests/testsuite/search.rs | 4 +++- tests/testsuite/shell_quoting.rs | 1 + tests/testsuite/source_replacement.rs | 1 + tests/testsuite/ssh.rs | 8 +++++--- tests/testsuite/standard_lib.rs | 4 +++- tests/testsuite/test.rs | 3 ++- tests/testsuite/timings.rs | 1 + tests/testsuite/tool_paths.rs | 1 + tests/testsuite/tree.rs | 4 +++- tests/testsuite/tree_graph_features.rs | 1 + tests/testsuite/verify_project.rs | 1 + tests/testsuite/version.rs | 1 + tests/testsuite/warn_on_failure.rs | 1 + tests/testsuite/weak_dep_features.rs | 7 +++++-- tests/testsuite/workspaces.rs | 6 ++++-- tests/testsuite/yank.rs | 1 + 164 files changed, 295 insertions(+), 112 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 022279f2a6d..482cd584b6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,6 @@ dependencies = [ "cargo-credential-macos-keychain", "cargo-credential-wincred", "cargo-platform 0.1.8", - "cargo-test-macro", "cargo-test-support", "cargo-util", "cargo-util-schemas", diff --git a/Cargo.toml b/Cargo.toml index 8817e17c50b..b3a8f1b0c55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -237,7 +237,6 @@ features = [ [dev-dependencies] annotate-snippets = { workspace = true, features = ["testing-colors"] } -cargo-test-macro.workspace = true cargo-test-support.workspace = true gix = { workspace = true, features = ["revision"] } same-file.workspace = true diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 54197c5b18f..1075643219c 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -21,7 +21,7 @@ #![allow(clippy::disallowed_methods)] use cargo_test_support::prelude::*; -use cargo_test_support::*; +use cargo_test_support::{basic_manifest, paths, project, rustc_host, str, Execs}; use std::env; use std::path::Path; diff --git a/tests/testsuite/advanced_env.rs b/tests/testsuite/advanced_env.rs index fb65839a205..d2a1170789c 100644 --- a/tests/testsuite/advanced_env.rs +++ b/tests/testsuite/advanced_env.rs @@ -1,5 +1,6 @@ //! -Zadvanced-env tests +use cargo_test_support::prelude::*; use cargo_test_support::{paths, project, registry::Package}; #[cargo_test] diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index 3bb54448d2c..7d2877d606c 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -1,12 +1,13 @@ //! Tests for alternative registries. +use std::fs; + use cargo_test_support::compare::assert_e2e; use cargo_test_support::prelude::*; use cargo_test_support::publish::validate_alt_upload; use cargo_test_support::registry::{self, Package, RegistryBuilder}; use cargo_test_support::str; use cargo_test_support::{basic_manifest, paths, project}; -use std::fs; #[cargo_test] fn depend_on_alt_registry() { diff --git a/tests/testsuite/artifact_dir.rs b/tests/testsuite/artifact_dir.rs index 8f82ece5f3d..982c68b616d 100644 --- a/tests/testsuite/artifact_dir.rs +++ b/tests/testsuite/artifact_dir.rs @@ -1,12 +1,13 @@ //! Tests for --artifact-dir flag. +use std::env; +use std::fs; +use std::path::Path; + use cargo_test_support::prelude::*; use cargo_test_support::sleep_ms; use cargo_test_support::str; use cargo_test_support::{basic_manifest, project}; -use std::env; -use std::fs; -use std::path::Path; #[cargo_test] fn binary_with_debug() { diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index b3d14962726..49eb60db0c2 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -1,5 +1,10 @@ //! Tests for the `cargo build` command. +use std::env; +use std::fs; +use std::io::Read; +use std::process::Stdio; + use cargo::{ core::compiler::CompileMode, core::{Shell, Workspace}, @@ -17,10 +22,6 @@ use cargo_test_support::{ tools, Execs, ProjectBuilder, }; use cargo_util::paths::dylib_path_envvar; -use std::env; -use std::fs; -use std::io::Read; -use std::process::Stdio; #[cargo_test] fn cargo_compile_simple() { diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 35c340e2147..6dce3d130c7 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -1,5 +1,10 @@ //! Tests for build.rs scripts. +use std::env; +use std::fs; +use std::io; +use std::thread; + use cargo_test_support::compare::assert_e2e; use cargo_test_support::install::cargo_home; use cargo_test_support::paths::CargoPathExt; @@ -12,10 +17,6 @@ use cargo_test_support::{ }; use cargo_test_support::{rustc_host, sleep_ms, slow_cpu_multiplier, symlink_supported}; use cargo_util::paths::{self, remove_dir_all}; -use std::env; -use std::fs; -use std::io; -use std::thread; #[cargo_test] fn custom_build_script_failed() { diff --git a/tests/testsuite/build_script_env.rs b/tests/testsuite/build_script_env.rs index c22bb4f6ac5..2c6b984b070 100644 --- a/tests/testsuite/build_script_env.rs +++ b/tests/testsuite/build_script_env.rs @@ -1,6 +1,7 @@ //! Tests for build.rs rerun-if-env-changed and rustc-env use cargo_test_support::basic_manifest; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::sleep_ms; use cargo_test_support::str; diff --git a/tests/testsuite/build_script_extra_link_arg.rs b/tests/testsuite/build_script_extra_link_arg.rs index ca7b4863cd3..c7cd8b5fd24 100644 --- a/tests/testsuite/build_script_extra_link_arg.rs +++ b/tests/testsuite/build_script_extra_link_arg.rs @@ -4,6 +4,7 @@ // because MSVC link.exe just gives a warning on unknown flags (how helpful!), // and other linkers will return an error. +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project}; diff --git a/tests/testsuite/cache_lock.rs b/tests/testsuite/cache_lock.rs index 8304eaebe72..49468a2f957 100644 --- a/tests/testsuite/cache_lock.rs +++ b/tests/testsuite/cache_lock.rs @@ -1,10 +1,13 @@ //! Tests for `CacheLock`. -use crate::config::GlobalContextBuilder; +use std::thread::JoinHandle; + use cargo::util::cache_lock::{CacheLockMode, CacheLocker}; use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::{retry, thread_wait_timeout, threaded_timeout}; -use std::thread::JoinHandle; + +use crate::config::GlobalContextBuilder; /// Helper to verify that it is OK to acquire the given lock (it shouldn't block). fn verify_lock_is_ok(mode: CacheLockMode) { diff --git a/tests/testsuite/cache_messages.rs b/tests/testsuite/cache_messages.rs index 6a14f9c74f6..4f003e79676 100644 --- a/tests/testsuite/cache_messages.rs +++ b/tests/testsuite/cache_messages.rs @@ -1,10 +1,12 @@ //! Tests for caching compiler diagnostics. -use super::messages::raw_rustc_output; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::tools; use cargo_test_support::{basic_manifest, is_coarse_mtime, project, registry::Package, sleep_ms}; +use super::messages::raw_rustc_output; + fn as_str(bytes: &[u8]) -> &str { std::str::from_utf8(bytes).expect("valid utf-8") } diff --git a/tests/testsuite/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs index 0cf807b15e8..2ad9d99c388 100644 --- a/tests/testsuite/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -2,6 +2,7 @@ use std::env; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::tools::echo_subcommand; use cargo_test_support::{basic_bin_manifest, project}; diff --git a/tests/testsuite/cargo_bench/no_keep_going/mod.rs b/tests/testsuite/cargo_bench/no_keep_going/mod.rs index 4226dc1c66a..058fe8eb3ad 100644 --- a/tests/testsuite/cargo_bench/no_keep_going/mod.rs +++ b/tests/testsuite/cargo_bench/no_keep_going/mod.rs @@ -1,5 +1,6 @@ use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index 5272fdb2889..4bbe4e38830 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -9,6 +9,7 @@ use std::str; use cargo_test_support::basic_manifest; use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::tools::echo_subcommand; diff --git a/tests/testsuite/cargo_env_config.rs b/tests/testsuite/cargo_env_config.rs index 1dc64add3ca..369a5a8699e 100644 --- a/tests/testsuite/cargo_env_config.rs +++ b/tests/testsuite/cargo_env_config.rs @@ -1,6 +1,7 @@ //! Tests for `[env]` config. use cargo_test_support::basic_manifest; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::{basic_bin_manifest, project}; diff --git a/tests/testsuite/cargo_features.rs b/tests/testsuite/cargo_features.rs index aedc5831297..7c61f126441 100644 --- a/tests/testsuite/cargo_features.rs +++ b/tests/testsuite/cargo_features.rs @@ -1,5 +1,6 @@ //! Tests for `cargo-features` definitions. +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{project, registry}; diff --git a/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs b/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs index cd912bb03b0..596364eec55 100644 --- a/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs +++ b/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_init/reserved_name/mod.rs b/tests/testsuite/cargo_init/reserved_name/mod.rs index 91b4de8b4b3..1c06c940192 100644 --- a/tests/testsuite/cargo_init/reserved_name/mod.rs +++ b/tests/testsuite/cargo_init/reserved_name/mod.rs @@ -1,8 +1,9 @@ +use std::fs; + use cargo_test_support::file; use cargo_test_support::paths; use cargo_test_support::prelude::*; use cargo_test_support::str; -use std::fs; #[cargo_test] fn case() { diff --git a/tests/testsuite/cargo_new/add_members_to_non_workspace/mod.rs b/tests/testsuite/cargo_new/add_members_to_non_workspace/mod.rs index 9a6e7c5486b..727221d42e6 100644 --- a/tests/testsuite/cargo_new/add_members_to_non_workspace/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_non_workspace/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_format_previous_items/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_format_previous_items/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_format_previous_items/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_format_previous_items/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_format_sorted/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_format_sorted/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_format_sorted/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_format_sorted/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_with_absolute_package_path/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_with_absolute_package_path/mod.rs index d666c0aca71..837746e92e4 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_with_absolute_package_path/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_with_absolute_package_path/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_with_empty_members/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_with_empty_members/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_with_empty_members/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_with_empty_members/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_with_members_glob/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_with_members_glob/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_with_members_glob/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_with_members_glob/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_without_members/mod.rs b/tests/testsuite/cargo_new/add_members_to_workspace_without_members/mod.rs index 9a6e7c5486b..727221d42e6 100644 --- a/tests/testsuite/cargo_new/add_members_to_workspace_without_members/mod.rs +++ b/tests/testsuite/cargo_new/add_members_to_workspace_without_members/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/empty_name/mod.rs b/tests/testsuite/cargo_new/empty_name/mod.rs index da6fb0e2d64..62e401c996d 100644 --- a/tests/testsuite/cargo_new/empty_name/mod.rs +++ b/tests/testsuite/cargo_new/empty_name/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/inherit_workspace_lints/mod.rs b/tests/testsuite/cargo_new/inherit_workspace_lints/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/inherit_workspace_lints/mod.rs +++ b/tests/testsuite/cargo_new/inherit_workspace_lints/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table/mod.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/inherit_workspace_package_table/mod.rs +++ b/tests/testsuite/cargo_new/inherit_workspace_package_table/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/mod.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/mod.rs index 9c8c2a404fd..b91ad86b633 100644 --- a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/mod.rs +++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/mod.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/mod.rs index 51883bd4993..30d44a91a28 100644 --- a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/mod.rs +++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/mod.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/mod.rs index f3411259b3b..f59a989d672 100644 --- a/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/mod.rs +++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/mod.rs b/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/mod.rs index 54796a00eb3..a05ae9a48cd 100644 --- a/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/mod.rs +++ b/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs b/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs index e5f3e34815a..fa59936b5a6 100644 --- a/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/build/mod.rs b/tests/testsuite/cargo_remove/build/mod.rs index 8320d824744..b0704b56a71 100644 --- a/tests/testsuite/cargo_remove/build/mod.rs +++ b/tests/testsuite/cargo_remove/build/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/dev/mod.rs b/tests/testsuite/cargo_remove/dev/mod.rs index b8594662b79..21a45347bfb 100644 --- a/tests/testsuite/cargo_remove/dev/mod.rs +++ b/tests/testsuite/cargo_remove/dev/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/dry_run/mod.rs b/tests/testsuite/cargo_remove/dry_run/mod.rs index b1b2280f51b..bc537fb41e4 100644 --- a/tests/testsuite/cargo_remove/dry_run/mod.rs +++ b/tests/testsuite/cargo_remove/dry_run/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs b/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs index f27ef6f6fb6..8dac5069620 100644 --- a/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs +++ b/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/gc_patch/mod.rs b/tests/testsuite/cargo_remove/gc_patch/mod.rs index ce9cad4ecb3..c2a92071b03 100644 --- a/tests/testsuite/cargo_remove/gc_patch/mod.rs +++ b/tests/testsuite/cargo_remove/gc_patch/mod.rs @@ -3,6 +3,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; use cargo_test_support::git; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; use cargo_test_support::CargoCommand; diff --git a/tests/testsuite/cargo_remove/gc_profile/mod.rs b/tests/testsuite/cargo_remove/gc_profile/mod.rs index a0e65886f60..d4e57425fbe 100644 --- a/tests/testsuite/cargo_remove/gc_profile/mod.rs +++ b/tests/testsuite/cargo_remove/gc_profile/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/gc_replace/mod.rs b/tests/testsuite/cargo_remove/gc_replace/mod.rs index e56e467d9e9..e7c288ee4a3 100644 --- a/tests/testsuite/cargo_remove/gc_replace/mod.rs +++ b/tests/testsuite/cargo_remove/gc_replace/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_arg/mod.rs b/tests/testsuite/cargo_remove/invalid_arg/mod.rs index cf225b122ef..fdbb3049adf 100644 --- a/tests/testsuite/cargo_remove/invalid_arg/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_arg/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_dep/mod.rs index 3e225cf2fe9..f766c73c1ca 100644 --- a/tests/testsuite/cargo_remove/invalid_dep/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_dep/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_package/mod.rs b/tests/testsuite/cargo_remove/invalid_package/mod.rs index fe90a957d19..b222921d971 100644 --- a/tests/testsuite/cargo_remove/invalid_package/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_package/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs b/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs index 0fe7d12f35c..82c6389ea85 100644 --- a/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_section/mod.rs b/tests/testsuite/cargo_remove/invalid_section/mod.rs index 7e5e43e18d9..0dd84961c41 100644 --- a/tests/testsuite/cargo_remove/invalid_section/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_section/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs index 601ebe8e65c..47d8cdc1411 100644 --- a/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_target/mod.rs b/tests/testsuite/cargo_remove/invalid_target/mod.rs index 8e099128f3e..522019b193d 100644 --- a/tests/testsuite/cargo_remove/invalid_target/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_target/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs index 123787f79d2..e0433184201 100644 --- a/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/multiple_deps/mod.rs b/tests/testsuite/cargo_remove/multiple_deps/mod.rs index 1a86d276576..6fa3cfb520b 100644 --- a/tests/testsuite/cargo_remove/multiple_deps/mod.rs +++ b/tests/testsuite/cargo_remove/multiple_deps/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/multiple_dev/mod.rs b/tests/testsuite/cargo_remove/multiple_dev/mod.rs index 52831495f0d..54252e4e907 100644 --- a/tests/testsuite/cargo_remove/multiple_dev/mod.rs +++ b/tests/testsuite/cargo_remove/multiple_dev/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/no_arg/mod.rs b/tests/testsuite/cargo_remove/no_arg/mod.rs index 920826ac538..87df427a5fd 100644 --- a/tests/testsuite/cargo_remove/no_arg/mod.rs +++ b/tests/testsuite/cargo_remove/no_arg/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/offline/mod.rs b/tests/testsuite/cargo_remove/offline/mod.rs index 1aed4a20f47..921082b0628 100644 --- a/tests/testsuite/cargo_remove/offline/mod.rs +++ b/tests/testsuite/cargo_remove/offline/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs b/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs index a4a08c2a03c..cc16de2d68f 100644 --- a/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs +++ b/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/optional_dep_feature_formatting/mod.rs b/tests/testsuite/cargo_remove/optional_dep_feature_formatting/mod.rs index a88fd9995f3..735af20d88b 100644 --- a/tests/testsuite/cargo_remove/optional_dep_feature_formatting/mod.rs +++ b/tests/testsuite/cargo_remove/optional_dep_feature_formatting/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/optional_feature/mod.rs b/tests/testsuite/cargo_remove/optional_feature/mod.rs index 2d9a7680222..e32b1391e36 100644 --- a/tests/testsuite/cargo_remove/optional_feature/mod.rs +++ b/tests/testsuite/cargo_remove/optional_feature/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/package/mod.rs b/tests/testsuite/cargo_remove/package/mod.rs index 3c7298198c8..4712da23ad1 100644 --- a/tests/testsuite/cargo_remove/package/mod.rs +++ b/tests/testsuite/cargo_remove/package/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/remove_basic/mod.rs b/tests/testsuite/cargo_remove/remove_basic/mod.rs index 8d3ef22ef8d..ca492a6b59b 100644 --- a/tests/testsuite/cargo_remove/remove_basic/mod.rs +++ b/tests/testsuite/cargo_remove/remove_basic/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/skip_gc_glob_profile/mod.rs b/tests/testsuite/cargo_remove/skip_gc_glob_profile/mod.rs index 40f0dde4633..832444fa8a2 100644 --- a/tests/testsuite/cargo_remove/skip_gc_glob_profile/mod.rs +++ b/tests/testsuite/cargo_remove/skip_gc_glob_profile/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/target/mod.rs b/tests/testsuite/cargo_remove/target/mod.rs index e24b5043402..34f563c8cc8 100644 --- a/tests/testsuite/cargo_remove/target/mod.rs +++ b/tests/testsuite/cargo_remove/target/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/target_build/mod.rs b/tests/testsuite/cargo_remove/target_build/mod.rs index 2c1c8f2d1a6..10d8e4d2b6e 100644 --- a/tests/testsuite/cargo_remove/target_build/mod.rs +++ b/tests/testsuite/cargo_remove/target_build/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/target_dev/mod.rs b/tests/testsuite/cargo_remove/target_dev/mod.rs index fc75871f2bc..2bd5042af6f 100644 --- a/tests/testsuite/cargo_remove/target_dev/mod.rs +++ b/tests/testsuite/cargo_remove/target_dev/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/update_lock_file/mod.rs b/tests/testsuite/cargo_remove/update_lock_file/mod.rs index df1ecb42d7d..9607be6da97 100644 --- a/tests/testsuite/cargo_remove/update_lock_file/mod.rs +++ b/tests/testsuite/cargo_remove/update_lock_file/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/workspace/mod.rs b/tests/testsuite/cargo_remove/workspace/mod.rs index ea9e4c1a8b9..9e8e1aa29db 100644 --- a/tests/testsuite/cargo_remove/workspace/mod.rs +++ b/tests/testsuite/cargo_remove/workspace/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs b/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs index ea9e4c1a8b9..9e8e1aa29db 100644 --- a/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs +++ b/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_remove/workspace_preserved/mod.rs b/tests/testsuite/cargo_remove/workspace_preserved/mod.rs index ea9e4c1a8b9..9e8e1aa29db 100644 --- a/tests/testsuite/cargo_remove/workspace_preserved/mod.rs +++ b/tests/testsuite/cargo_remove/workspace_preserved/mod.rs @@ -1,6 +1,7 @@ use cargo_test_support::compare::assert_ui; use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cargo_targets.rs b/tests/testsuite/cargo_targets.rs index f18e5dbf05f..beec558d962 100644 --- a/tests/testsuite/cargo_targets.rs +++ b/tests/testsuite/cargo_targets.rs @@ -1,5 +1,6 @@ //! Tests specifically related to target handling (lib, bins, examples, tests, benches). +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/cargo_test/no_keep_going/mod.rs b/tests/testsuite/cargo_test/no_keep_going/mod.rs index a07cc64ae88..bb5731427f8 100644 --- a/tests/testsuite/cargo_test/no_keep_going/mod.rs +++ b/tests/testsuite/cargo_test/no_keep_going/mod.rs @@ -1,5 +1,6 @@ use cargo_test_support::current_dir; use cargo_test_support::file; +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::CargoCommand; use cargo_test_support::Project; diff --git a/tests/testsuite/cfg.rs b/tests/testsuite/cfg.rs index 3a2ad71253d..3ad6f1f5fa9 100644 --- a/tests/testsuite/cfg.rs +++ b/tests/testsuite/cfg.rs @@ -1,5 +1,6 @@ //! Tests for cfg() expressions. +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::rustc_host; use cargo_test_support::{basic_manifest, project, str}; diff --git a/tests/testsuite/concurrent.rs b/tests/testsuite/concurrent.rs index 3b6f936a143..b0bd5bd3df7 100644 --- a/tests/testsuite/concurrent.rs +++ b/tests/testsuite/concurrent.rs @@ -10,6 +10,7 @@ use std::{env, str}; use cargo_test_support::cargo_process; use cargo_test_support::git; use cargo_test_support::install::{assert_has_installed_exe, cargo_home}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_manifest, execs, project, slow_cpu_multiplier}; diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 6ca48cc9a09..6d0a3ff8ef2 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -1,5 +1,12 @@ //! Tests for config settings. +use std::borrow::Borrow; +use std::collections::{BTreeMap, HashMap}; +use std::fs; +use std::io; +use std::os; +use std::path::{Path, PathBuf}; + use cargo::core::features::{GitFeatures, GitoxideFeatures}; use cargo::core::{PackageIdSpec, Shell}; use cargo::util::context::{ @@ -14,12 +21,6 @@ use cargo_util_schemas::manifest::TomlTrimPaths; use cargo_util_schemas::manifest::TomlTrimPathsValue; use cargo_util_schemas::manifest::{self as cargo_toml, TomlDebugInfo, VecStringOrBool as VSOB}; use serde::Deserialize; -use std::borrow::Borrow; -use std::collections::{BTreeMap, HashMap}; -use std::fs; -use std::io; -use std::os; -use std::path::{Path, PathBuf}; /// Helper for constructing a `GlobalContext` object. pub struct GlobalContextBuilder { diff --git a/tests/testsuite/config_cli.rs b/tests/testsuite/config_cli.rs index cf6a52fedf4..c9eed19fd8f 100644 --- a/tests/testsuite/config_cli.rs +++ b/tests/testsuite/config_cli.rs @@ -1,13 +1,16 @@ //! Tests for the --config CLI option. -use super::config::{ - assert_error, read_output, write_config_at, write_config_toml, GlobalContextBuilder, -}; +use std::{collections::HashMap, fs}; + use cargo::util::context::Definition; use cargo_test_support::compare::assert_e2e; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::str; -use std::{collections::HashMap, fs}; + +use super::config::{ + assert_error, read_output, write_config_at, write_config_toml, GlobalContextBuilder, +}; #[cargo_test] fn basic() { diff --git a/tests/testsuite/config_include.rs b/tests/testsuite/config_include.rs index 502ac7e919f..1bb7e717a57 100644 --- a/tests/testsuite/config_include.rs +++ b/tests/testsuite/config_include.rs @@ -1,9 +1,11 @@ //! Tests for `include` config field. -use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder}; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; +use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder}; + #[cargo_test] fn gated() { // Requires -Z flag. diff --git a/tests/testsuite/corrupt_git.rs b/tests/testsuite/corrupt_git.rs index 2569e460b27..ee4c720fbab 100644 --- a/tests/testsuite/corrupt_git.rs +++ b/tests/testsuite/corrupt_git.rs @@ -1,10 +1,12 @@ //! Tests for corrupt git repos. +use std::fs; +use std::path::{Path, PathBuf}; + use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::{basic_manifest, git, project}; use cargo_util::paths as cargopaths; -use std::fs; -use std::path::{Path, PathBuf}; #[cargo_test] fn deleting_database_files() { diff --git a/tests/testsuite/credential_process.rs b/tests/testsuite/credential_process.rs index 2ee3a133342..a07006d549b 100644 --- a/tests/testsuite/credential_process.rs +++ b/tests/testsuite/credential_process.rs @@ -1,5 +1,6 @@ //! Tests for credential-process. +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Package, TestRegistry}; use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, str, Project}; diff --git a/tests/testsuite/cross_publish.rs b/tests/testsuite/cross_publish.rs index fcf7a0697b8..2646dea4083 100644 --- a/tests/testsuite/cross_publish.rs +++ b/tests/testsuite/cross_publish.rs @@ -2,6 +2,7 @@ use std::fs::File; +use cargo_test_support::prelude::*; use cargo_test_support::{cross_compile, project, publish, registry, str}; #[cargo_test] diff --git a/tests/testsuite/custom_target.rs b/tests/testsuite/custom_target.rs index 7c116221da8..feafccf2a09 100644 --- a/tests/testsuite/custom_target.rs +++ b/tests/testsuite/custom_target.rs @@ -1,8 +1,10 @@ //! Tests for custom json target specifications. -use cargo_test_support::{basic_manifest, project, str}; use std::fs; +use cargo_test_support::prelude::*; +use cargo_test_support::{basic_manifest, project, str}; + const MINIMAL_LIB: &str = r#" #![allow(internal_features)] #![feature(no_core)] diff --git a/tests/testsuite/death.rs b/tests/testsuite/death.rs index f9049a8f168..f57b74de518 100644 --- a/tests/testsuite/death.rs +++ b/tests/testsuite/death.rs @@ -1,12 +1,14 @@ //! Tests for ctrl-C handling. -use cargo_test_support::{project, slow_cpu_multiplier}; use std::fs; use std::io::{self, Read}; use std::net::TcpListener; use std::process::{Child, Stdio}; use std::thread; +use cargo_test_support::prelude::*; +use cargo_test_support::{project, slow_cpu_multiplier}; + #[cargo_test] fn ctrl_c_kills_everyone() { let listener = TcpListener::bind("127.0.0.1:0").unwrap(); diff --git a/tests/testsuite/dep_info.rs b/tests/testsuite/dep_info.rs index 805cdc2801e..451506c83e9 100644 --- a/tests/testsuite/dep_info.rs +++ b/tests/testsuite/dep_info.rs @@ -1,17 +1,19 @@ //! Tests for dep-info files. This includes the dep-info file Cargo creates in //! the output directory, and the ones stored in the fingerprint. +use std::fs; +use std::path::Path; +use std::str; + use cargo_test_support::compare::assert_e2e; use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{ basic_bin_manifest, basic_manifest, main_file, project, rustc_host, Project, }; use filetime::FileTime; -use std::fs; -use std::path::Path; -use std::str; // Helper for testing dep-info files in the fingerprint dir. #[track_caller] diff --git a/tests/testsuite/diagnostics.rs b/tests/testsuite/diagnostics.rs index af561cb5d61..8bbebf0b79d 100644 --- a/tests/testsuite/diagnostics.rs +++ b/tests/testsuite/diagnostics.rs @@ -1,3 +1,4 @@ +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/direct_minimal_versions.rs b/tests/testsuite/direct_minimal_versions.rs index e96436fc124..6753ebc1115 100644 --- a/tests/testsuite/direct_minimal_versions.rs +++ b/tests/testsuite/direct_minimal_versions.rs @@ -2,6 +2,7 @@ //! //! Note: Some tests are located in the resolver-tests package. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs index cf24a0ba99e..b7ba19dd6bb 100644 --- a/tests/testsuite/directory.rs +++ b/tests/testsuite/directory.rs @@ -4,14 +4,14 @@ use std::collections::HashMap; use std::fs; use std::str; -use serde::Serialize; - use cargo_test_support::cargo_process; use cargo_test_support::git; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{cksum, Package}; use cargo_test_support::str; use cargo_test_support::{basic_manifest, project, t, ProjectBuilder}; +use serde::Serialize; fn setup() { let root = paths::root(); diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 809fb3211d7..274c33b8021 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -1,5 +1,8 @@ //! Tests for the `cargo doc` command. +use std::fs; +use std::str; + use cargo::core::compiler::RustDocFingerprint; use cargo_test_support::paths::CargoPathExt; use cargo_test_support::prelude::*; @@ -7,8 +10,6 @@ use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_lib_manifest, basic_manifest, git, project}; use cargo_test_support::{rustc_host, symlink_supported, tools}; -use std::fs; -use std::str; #[cargo_test] fn simple() { diff --git a/tests/testsuite/edition.rs b/tests/testsuite/edition.rs index 436c1c0f367..92f75b181d4 100644 --- a/tests/testsuite/edition.rs +++ b/tests/testsuite/edition.rs @@ -1,6 +1,7 @@ //! Tests for edition setting. use cargo::core::Edition; +use cargo_test_support::prelude::*; use cargo_test_support::{basic_lib_manifest, project, str}; #[cargo_test] diff --git a/tests/testsuite/error.rs b/tests/testsuite/error.rs index 69c602da1c5..2d64c73e718 100644 --- a/tests/testsuite/error.rs +++ b/tests/testsuite/error.rs @@ -1,6 +1,7 @@ //! General error tests that don't belong anywhere else. use cargo_test_support::cargo_process; +use cargo_test_support::prelude::*; #[cargo_test] fn internal_error() { diff --git a/tests/testsuite/features2.rs b/tests/testsuite/features2.rs index 200094dcce4..164a0ca27d3 100644 --- a/tests/testsuite/features2.rs +++ b/tests/testsuite/features2.rs @@ -1,5 +1,7 @@ //! Tests for the new feature resolver. +use std::fs::File; + use cargo_test_support::cross_compile::{self, alternate}; use cargo_test_support::install::cargo_home; use cargo_test_support::paths::CargoPathExt; @@ -8,7 +10,6 @@ use cargo_test_support::publish::validate_crate_contents; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::str; use cargo_test_support::{basic_manifest, cargo_process, project, rustc_host, Project}; -use std::fs::File; /// Switches Cargo.toml to use `resolver = "2"`. pub fn switch_to_resolver_2(p: &Project) { diff --git a/tests/testsuite/features_namespaced.rs b/tests/testsuite/features_namespaced.rs index f47cfbbbe8d..f0835a00604 100644 --- a/tests/testsuite/features_namespaced.rs +++ b/tests/testsuite/features_namespaced.rs @@ -1,11 +1,12 @@ //! Tests for namespaced features. -use super::features2::switch_to_resolver_2; use cargo_test_support::prelude::*; use cargo_test_support::registry::{Dependency, Package, RegistryBuilder}; use cargo_test_support::str; use cargo_test_support::{project, publish}; +use super::features2::switch_to_resolver_2; + #[cargo_test] fn dependency_with_crate_syntax() { // Registry dependency uses dep: syntax. diff --git a/tests/testsuite/fetch.rs b/tests/testsuite/fetch.rs index d90004a220a..194943ddeaf 100644 --- a/tests/testsuite/fetch.rs +++ b/tests/testsuite/fetch.rs @@ -2,6 +2,7 @@ #![allow(deprecated)] +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::rustc_host; use cargo_test_support::{basic_manifest, cross_compile, project}; diff --git a/tests/testsuite/fix_n_times.rs b/tests/testsuite/fix_n_times.rs index 9bbb7a1da19..e6092ae8c55 100644 --- a/tests/testsuite/fix_n_times.rs +++ b/tests/testsuite/fix_n_times.rs @@ -14,11 +14,12 @@ //! The [`expect_fix_runs_rustc_n_times`] function handles setting everything //! up, and verifying the results. -use cargo_test_support::{basic_manifest, paths, project, str, tools, Execs}; -use snapbox::IntoData; use std::path::PathBuf; use std::sync::{Mutex, OnceLock}; +use cargo_test_support::prelude::*; +use cargo_test_support::{basic_manifest, paths, project, str, tools, Execs}; + /// The action that the `rustc` shim should take in the current sequence of /// events. #[derive(Clone, Copy, PartialEq)] diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 9381ed9688e..c317afd48ab 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -1,7 +1,5 @@ //! Tests for fingerprinting (rebuild detection). -use filetime::FileTime; -use snapbox::IntoData; use std::fs::{self, OpenOptions}; use std::io; use std::io::prelude::*; @@ -11,13 +9,16 @@ use std::process::Stdio; use std::thread; use std::time::SystemTime; -use super::death; use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{ basic_lib_manifest, basic_manifest, is_coarse_mtime, project, rustc_host, rustc_host_env, sleep_ms, str, }; +use filetime::FileTime; + +use super::death; #[cargo_test] fn modifying_and_moving() { diff --git a/tests/testsuite/future_incompat_report.rs b/tests/testsuite/future_incompat_report.rs index 7f9573d2911..8d0592291fc 100644 --- a/tests/testsuite/future_incompat_report.rs +++ b/tests/testsuite/future_incompat_report.rs @@ -7,10 +7,12 @@ //! So we pick some random lint that will likely always be the same //! over time. -use super::config::write_config_toml; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, project, str, Project}; +use super::config::write_config_toml; + // An arbitrary lint (unused_variables) that triggers a lint. // We use a special flag to force it to generate a report. const FUTURE_EXAMPLE: &'static str = "fn main() { let x = 1; }"; diff --git a/tests/testsuite/generate_lockfile.rs b/tests/testsuite/generate_lockfile.rs index 24b0ef03dd8..057a5d9aded 100644 --- a/tests/testsuite/generate_lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -1,9 +1,10 @@ //! Tests for the `cargo generate-lockfile` command. +use std::fs; + +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Package, RegistryBuilder}; use cargo_test_support::{basic_manifest, paths, project, str, ProjectBuilder}; -use snapbox::IntoData; -use std::fs; #[cargo_test] fn adding_and_removing_packages() { diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index 9826ab051b8..84dce88a062 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -12,6 +12,7 @@ use std::thread; use cargo_test_support::git::cargo_uses_gitoxide; use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::prelude::IntoData; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{basic_lib_manifest, basic_manifest, git, main_file, path2url, project}; use cargo_test_support::{sleep_ms, str, t, Project}; diff --git a/tests/testsuite/git_auth.rs b/tests/testsuite/git_auth.rs index 16eefb20171..e51c107813b 100644 --- a/tests/testsuite/git_auth.rs +++ b/tests/testsuite/git_auth.rs @@ -11,6 +11,7 @@ use std::thread::{self, JoinHandle}; use cargo_test_support::basic_manifest; use cargo_test_support::git::cargo_uses_gitoxide; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::project; fn setup_failed_auth_test() -> (SocketAddr, JoinHandle<()>, Arc) { diff --git a/tests/testsuite/git_gc.rs b/tests/testsuite/git_gc.rs index fd4fe30a979..fa1791fee8c 100644 --- a/tests/testsuite/git_gc.rs +++ b/tests/testsuite/git_gc.rs @@ -7,9 +7,9 @@ use std::path::PathBuf; use cargo_test_support::git; use cargo_test_support::git::cargo_uses_gitoxide; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; - use url::Url; pub fn find_index() -> PathBuf { diff --git a/tests/testsuite/git_shallow.rs b/tests/testsuite/git_shallow.rs index 9711231e344..6a45621e63b 100644 --- a/tests/testsuite/git_shallow.rs +++ b/tests/testsuite/git_shallow.rs @@ -1,7 +1,9 @@ -use crate::git_gc::find_index; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, git, paths, project}; +use crate::git_gc::find_index; + enum RepoMode { Shallow, Complete, diff --git a/tests/testsuite/global_cache_tracker.rs b/tests/testsuite/global_cache_tracker.rs index 9c6638379f3..d405affc5e5 100644 --- a/tests/testsuite/global_cache_tracker.rs +++ b/tests/testsuite/global_cache_tracker.rs @@ -8,25 +8,28 @@ #![allow(deprecated)] -use super::config::GlobalContextBuilder; +use std::env; +use std::fmt::Write; +use std::path::Path; +use std::path::PathBuf; +use std::process::Stdio; +use std::sync::OnceLock; +use std::time::{Duration, SystemTime}; + use cargo::core::global_cache_tracker::{self, DeferredGlobalLastUse, GlobalCacheTracker}; use cargo::util::cache_lock::CacheLockMode; use cargo::util::interning::InternedString; use cargo::GlobalContext; use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Package, RegistryBuilder}; use cargo_test_support::{ basic_manifest, cargo_process, execs, git, process, project, retry, sleep_ms, thread_wait_timeout, Execs, Project, }; use itertools::Itertools; -use std::env; -use std::fmt::Write; -use std::path::Path; -use std::path::PathBuf; -use std::process::Stdio; -use std::sync::OnceLock; -use std::time::{Duration, SystemTime}; + +use super::config::GlobalContextBuilder; /// Helper to create a simple `foo` project which depends on a registry /// dependency called `bar`. diff --git a/tests/testsuite/help.rs b/tests/testsuite/help.rs index 801de16a586..1bbc3419b2f 100644 --- a/tests/testsuite/help.rs +++ b/tests/testsuite/help.rs @@ -1,12 +1,14 @@ //! Tests for cargo's help output. -use cargo_test_support::registry::Package; -use cargo_test_support::str; -use cargo_test_support::{basic_manifest, cargo_exe, cargo_process, paths, process, project}; use std::fs; use std::path::Path; use std::str::from_utf8; +use cargo_test_support::prelude::*; +use cargo_test_support::registry::Package; +use cargo_test_support::str; +use cargo_test_support::{basic_manifest, cargo_exe, cargo_process, paths, process, project}; + #[cargo_test] fn help() { cargo_process("").run(); diff --git a/tests/testsuite/https.rs b/tests/testsuite/https.rs index f012ac117d5..bc8bb221ec6 100644 --- a/tests/testsuite/https.rs +++ b/tests/testsuite/https.rs @@ -4,6 +4,7 @@ //! or CARGO_PUBLIC_NETWORK_TESTS. use cargo_test_support::containers::Container; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 7fa6eefb6b0..09ce2ec474f 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -1,8 +1,10 @@ //! Tests for the `cargo install` command. +use std::env; use std::fs::{self, OpenOptions}; use std::io::prelude::*; use std::path::Path; +use std::path::PathBuf; use std::thread; use cargo_test_support::compare::assert_e2e; @@ -20,8 +22,6 @@ use cargo_test_support::install::{ assert_has_installed_exe, assert_has_not_installed_exe, cargo_home, exe, }; use cargo_test_support::paths::{self, CargoPathExt}; -use std::env; -use std::path::PathBuf; fn pkg(name: &str, vers: &str) { Package::new(name, vers) diff --git a/tests/testsuite/install_upgrade.rs b/tests/testsuite/install_upgrade.rs index 84d38e43750..d3b74cd196c 100644 --- a/tests/testsuite/install_upgrade.rs +++ b/tests/testsuite/install_upgrade.rs @@ -1,14 +1,15 @@ //! Tests for `cargo install` where it upgrades a package if it is out-of-date. -use cargo::core::PackageId; use std::collections::BTreeSet; use std::env; use std::fs; use std::path::PathBuf; use std::sync::atomic::{AtomicUsize, Ordering}; +use cargo::core::PackageId; use cargo_test_support::install::{cargo_home, exe}; use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Package}; use cargo_test_support::{ basic_manifest, cargo_process, cross_compile, execs, git, process, project, str, Execs, diff --git a/tests/testsuite/jobserver.rs b/tests/testsuite/jobserver.rs index 7f1f108f563..b3b4def75d4 100644 --- a/tests/testsuite/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -1,6 +1,5 @@ //! Tests for the jobserver protocol. -use cargo_util::is_ci; use std::env; use std::net::TcpListener; use std::process::Command; @@ -10,7 +9,9 @@ use cargo_test_support::basic_bin_manifest; use cargo_test_support::cargo_exe; use cargo_test_support::install::assert_has_installed_exe; use cargo_test_support::install::cargo_home; +use cargo_test_support::prelude::*; use cargo_test_support::{project, rustc_host, str}; +use cargo_util::is_ci; const EXE_CONTENT: &str = r#" use std::env; diff --git a/tests/testsuite/lints/implicit_features.rs b/tests/testsuite/lints/implicit_features.rs index ba784e5cc0a..37a12ba69d9 100644 --- a/tests/testsuite/lints/implicit_features.rs +++ b/tests/testsuite/lints/implicit_features.rs @@ -1,3 +1,4 @@ +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/lints/mod.rs b/tests/testsuite/lints/mod.rs index 5bab5bca404..8d75258033b 100644 --- a/tests/testsuite/lints/mod.rs +++ b/tests/testsuite/lints/mod.rs @@ -1,3 +1,4 @@ +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/lints/unknown_lints.rs b/tests/testsuite/lints/unknown_lints.rs index 3c745217da9..f8b3e9d6fab 100644 --- a/tests/testsuite/lints/unknown_lints.rs +++ b/tests/testsuite/lints/unknown_lints.rs @@ -1,3 +1,4 @@ +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/lints/unused_optional_dependencies.rs b/tests/testsuite/lints/unused_optional_dependencies.rs index 3828211ff62..f6a38ee8652 100644 --- a/tests/testsuite/lints/unused_optional_dependencies.rs +++ b/tests/testsuite/lints/unused_optional_dependencies.rs @@ -1,3 +1,4 @@ +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/lints_table.rs b/tests/testsuite/lints_table.rs index 8c4e66aea31..746e4211cf8 100644 --- a/tests/testsuite/lints_table.rs +++ b/tests/testsuite/lints_table.rs @@ -1,5 +1,6 @@ //! Tests for `[lints]` +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/list_availables.rs b/tests/testsuite/list_availables.rs index 833e0373aed..4f217e3c4bf 100644 --- a/tests/testsuite/list_availables.rs +++ b/tests/testsuite/list_availables.rs @@ -3,6 +3,7 @@ #![allow(deprecated)] +use cargo_test_support::prelude::*; use cargo_test_support::project; const EXAMPLE: u8 = 1 << 0; diff --git a/tests/testsuite/local_registry.rs b/tests/testsuite/local_registry.rs index 750369209c1..42e2f18d410 100644 --- a/tests/testsuite/local_registry.rs +++ b/tests/testsuite/local_registry.rs @@ -1,10 +1,11 @@ //! Tests for local-registry sources. +use std::fs; + use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::prelude::*; use cargo_test_support::registry::{registry_path, Package}; use cargo_test_support::{basic_manifest, project, str, t}; -use std::fs; fn setup() { let root = paths::root(); diff --git a/tests/testsuite/lockfile_compat.rs b/tests/testsuite/lockfile_compat.rs index 42cbf963699..1cc9713ece8 100644 --- a/tests/testsuite/lockfile_compat.rs +++ b/tests/testsuite/lockfile_compat.rs @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_e2e; use cargo_test_support::git; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_lib_manifest, basic_manifest, project}; diff --git a/tests/testsuite/login.rs b/tests/testsuite/login.rs index f730f3d0a4d..fed64728435 100644 --- a/tests/testsuite/login.rs +++ b/tests/testsuite/login.rs @@ -1,12 +1,14 @@ //! Tests for the `cargo login` command. +use std::fs; +use std::path::PathBuf; + use cargo_test_support::cargo_process; use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, RegistryBuilder}; use cargo_test_support::str; use cargo_test_support::t; -use std::fs; -use std::path::PathBuf; const TOKEN: &str = "test-token"; const TOKEN2: &str = "test-token2"; diff --git a/tests/testsuite/logout.rs b/tests/testsuite/logout.rs index 5b4ab550d1c..0ff27076bd5 100644 --- a/tests/testsuite/logout.rs +++ b/tests/testsuite/logout.rs @@ -2,6 +2,7 @@ use super::login::check_token; use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::TestRegistry; use cargo_test_support::{cargo_process, registry, str}; diff --git a/tests/testsuite/lto.rs b/tests/testsuite/lto.rs index b4161d6a2ec..d58a5fbe998 100644 --- a/tests/testsuite/lto.rs +++ b/tests/testsuite/lto.rs @@ -1,8 +1,9 @@ +use std::process::Output; + use cargo::core::compiler::Lto; use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, project, str, Project}; -use std::process::Output; #[cargo_test] fn with_deps() { diff --git a/tests/testsuite/main.rs b/tests/testsuite/main.rs index f27f2aae158..271d333e2ef 100644 --- a/tests/testsuite/main.rs +++ b/tests/testsuite/main.rs @@ -2,9 +2,6 @@ #![allow(clippy::print_stderr)] #![allow(clippy::print_stdout)] -#[macro_use] -extern crate cargo_test_macro; - mod advanced_env; mod alt_registry; mod artifact_dep; @@ -186,6 +183,8 @@ mod weak_dep_features; mod workspaces; mod yank; +use cargo_test_support::prelude::*; + #[cargo_test] fn aaa_trigger_cross_compile_disabled_check() { // This triggers the cross compile disabled check to run ASAP, see #5141 diff --git a/tests/testsuite/member_discovery.rs b/tests/testsuite/member_discovery.rs index c44d5e48f47..7414562d0b6 100644 --- a/tests/testsuite/member_discovery.rs +++ b/tests/testsuite/member_discovery.rs @@ -2,8 +2,8 @@ use cargo::core::{Shell, Workspace}; use cargo::util::context::GlobalContext; - use cargo_test_support::install::cargo_home; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry; diff --git a/tests/testsuite/member_errors.rs b/tests/testsuite/member_errors.rs index 7a1309b8d3d..dd86f0ea939 100644 --- a/tests/testsuite/member_errors.rs +++ b/tests/testsuite/member_errors.rs @@ -4,8 +4,8 @@ use cargo::core::resolver::ResolveError; use cargo::core::{compiler::CompileMode, Shell, Workspace}; use cargo::ops::{self, CompileOptions}; use cargo::util::{context::GlobalContext, errors::ManifestError}; - use cargo_test_support::install::cargo_home; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry; use cargo_test_support::str; diff --git a/tests/testsuite/message_format.rs b/tests/testsuite/message_format.rs index ee53015a1e6..179911a9971 100644 --- a/tests/testsuite/message_format.rs +++ b/tests/testsuite/message_format.rs @@ -1,5 +1,6 @@ //! Tests for --message-format flag. +use cargo_test_support::prelude::*; use cargo_test_support::{basic_lib_manifest, basic_manifest, project, str}; #[cargo_test] diff --git a/tests/testsuite/messages.rs b/tests/testsuite/messages.rs index 0b083b5be9e..664c22a91a6 100644 --- a/tests/testsuite/messages.rs +++ b/tests/testsuite/messages.rs @@ -4,6 +4,7 @@ #![allow(deprecated)] +use cargo_test_support::prelude::*; use cargo_test_support::{process, project, Project}; use cargo_util::ProcessError; diff --git a/tests/testsuite/metabuild.rs b/tests/testsuite/metabuild.rs index 166c1520a99..f7cce0d104a 100644 --- a/tests/testsuite/metabuild.rs +++ b/tests/testsuite/metabuild.rs @@ -1,13 +1,13 @@ //! Tests for the metabuild feature (declarative build scripts). +use std::str; + use cargo_test_support::prelude::*; use cargo_test_support::{ basic_lib_manifest, basic_manifest, is_coarse_mtime, project, registry::Package, rustc_host, str, Project, }; -use std::str; - #[cargo_test] fn metabuild_gated() { let p = project() diff --git a/tests/testsuite/minimal_versions.rs b/tests/testsuite/minimal_versions.rs index 17f495c53ec..ca8a78ce992 100644 --- a/tests/testsuite/minimal_versions.rs +++ b/tests/testsuite/minimal_versions.rs @@ -2,6 +2,7 @@ //! //! Note: Some tests are located in the resolver-tests package. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/net_config.rs b/tests/testsuite/net_config.rs index 5a103f64208..b765678c71b 100644 --- a/tests/testsuite/net_config.rs +++ b/tests/testsuite/net_config.rs @@ -1,5 +1,6 @@ //! Tests for network configuration. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index 008fe32682c..f60849b562f 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -1,10 +1,12 @@ //! Tests for the `cargo new` command. +use std::env; +use std::fs::{self, File}; + use cargo_test_support::cargo_process; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::str; -use std::env; -use std::fs::{self, File}; fn create_default_gitconfig() { // This helps on Windows where libgit2 is very aggressive in attempting to diff --git a/tests/testsuite/offline.rs b/tests/testsuite/offline.rs index 7b0dab791c7..578b9efe40f 100644 --- a/tests/testsuite/offline.rs +++ b/tests/testsuite/offline.rs @@ -1,11 +1,13 @@ //! Tests for --offline flag. +use std::fs; + +use cargo_test_support::prelude::*; use cargo_test_support::{ basic_manifest, git, main_file, project, registry::{Package, RegistryBuilder}, str, Execs, }; -use std::fs; #[allow(deprecated)] #[cargo_test] diff --git a/tests/testsuite/old_cargos.rs b/tests/testsuite/old_cargos.rs index 8c810a9fc9f..e177b2bf0a2 100644 --- a/tests/testsuite/old_cargos.rs +++ b/tests/testsuite/old_cargos.rs @@ -12,13 +12,15 @@ #![allow(deprecated)] +use std::fs; + use cargo::CargoResult; use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Dependency, Package}; use cargo_test_support::{cargo_exe, execs, paths, process, project, rustc_host}; use cargo_util::{ProcessBuilder, ProcessError}; use semver::Version; -use std::fs; fn tc_process(cmd: &str, toolchain: &str) -> ProcessBuilder { let mut p = if toolchain == "this" { diff --git a/tests/testsuite/owner.rs b/tests/testsuite/owner.rs index e8b0370a439..7f7dd8f4b74 100644 --- a/tests/testsuite/owner.rs +++ b/tests/testsuite/owner.rs @@ -3,6 +3,7 @@ use std::fs; use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::{self, api_path}; use cargo_test_support::str; diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 703fe3b4ebe..773cdf75872 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -1,5 +1,8 @@ //! Tests for the `cargo package` command. +use std::fs::{self, read_to_string, File}; +use std::path::Path; + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::prelude::*; use cargo_test_support::publish::validate_crate_contents; @@ -9,8 +12,6 @@ use cargo_test_support::{ symlink_supported, t, ProjectBuilder, }; use flate2::read::GzDecoder; -use std::fs::{self, read_to_string, File}; -use std::path::Path; use tar::Archive; #[cargo_test] diff --git a/tests/testsuite/package_features.rs b/tests/testsuite/package_features.rs index 139d16da4c0..bf20ae63b3c 100644 --- a/tests/testsuite/package_features.rs +++ b/tests/testsuite/package_features.rs @@ -1,10 +1,12 @@ //! Tests for feature selection on the command-line. -use super::features2::switch_to_resolver_2; +use std::fmt::Write; + use cargo_test_support::prelude::*; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::{basic_manifest, project, str}; -use std::fmt::Write; + +use super::features2::switch_to_resolver_2; #[cargo_test] fn virtual_no_default_features() { diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 417773bf837..bc9bd535bf4 100644 --- a/tests/testsuite/patch.rs +++ b/tests/testsuite/patch.rs @@ -1,11 +1,12 @@ //! Tests for `[patch]` table source replacement. +use std::fs; + use cargo_test_support::git; use cargo_test_support::paths; use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Package}; use cargo_test_support::{basic_manifest, project, str}; -use std::fs; #[cargo_test] fn replace() { diff --git a/tests/testsuite/path.rs b/tests/testsuite/path.rs index 81cc13a84ed..ff5156d618c 100644 --- a/tests/testsuite/path.rs +++ b/tests/testsuite/path.rs @@ -1,11 +1,13 @@ //! Tests for `path` dependencies. +use std::fs; + use cargo_test_support::paths::{self, CargoPathExt}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_lib_manifest, basic_manifest, main_file, project}; use cargo_test_support::{sleep_ms, t}; -use std::fs; #[cargo_test] // I have no idea why this is failing spuriously on Windows; diff --git a/tests/testsuite/paths.rs b/tests/testsuite/paths.rs index 0b20583786b..6fdfafc1951 100644 --- a/tests/testsuite/paths.rs +++ b/tests/testsuite/paths.rs @@ -1,5 +1,6 @@ //! Tests for `paths` overrides. +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_manifest, project}; diff --git a/tests/testsuite/precise_pre_release.rs b/tests/testsuite/precise_pre_release.rs index 822e537b360..70e5e3fa5f0 100644 --- a/tests/testsuite/precise_pre_release.rs +++ b/tests/testsuite/precise_pre_release.rs @@ -1,5 +1,6 @@ //! Tests for selecting pre-release versions with `update --precise`. +use cargo_test_support::prelude::*; use cargo_test_support::{project, str}; #[cargo_test] diff --git a/tests/testsuite/profile_trim_paths.rs b/tests/testsuite/profile_trim_paths.rs index 25f04ad8b5e..776215e75dc 100644 --- a/tests/testsuite/profile_trim_paths.rs +++ b/tests/testsuite/profile_trim_paths.rs @@ -4,6 +4,7 @@ use cargo_test_support::basic_manifest; use cargo_test_support::compare::assert_e2e; use cargo_test_support::git; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index b400948ae69..cb96ee8b4da 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -1,9 +1,10 @@ //! Tests for profiles. +use std::env; + use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{project, rustc_host, str}; -use std::env; #[cargo_test] fn profile_overrides() { diff --git a/tests/testsuite/publish.rs b/tests/testsuite/publish.rs index 08756997b39..c03e726d6da 100644 --- a/tests/testsuite/publish.rs +++ b/tests/testsuite/publish.rs @@ -1,11 +1,13 @@ //! Tests for the `cargo publish` command. +use std::fs; +use std::sync::{Arc, Mutex}; + use cargo_test_support::git::{self, repo}; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Package, RegistryBuilder, Response}; use cargo_test_support::{basic_manifest, project, publish, str}; -use std::fs; -use std::sync::{Arc, Mutex}; const CLEAN_FOO_JSON: &str = r#" { diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index a4803ed09b8..dbdd84b1e20 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -1,5 +1,11 @@ //! Tests for normal registry dependencies. +use std::fmt::Write; +use std::fs::{self, File}; +use std::path::Path; +use std::sync::Arc; +use std::sync::Mutex; + use cargo::core::SourceId; use cargo_test_support::cargo_process; use cargo_test_support::paths::{self, CargoPathExt}; @@ -10,11 +16,6 @@ use cargo_test_support::registry::{ use cargo_test_support::{basic_manifest, project, str}; use cargo_test_support::{git, install::cargo_home, t}; use cargo_util::paths::remove_dir_all; -use std::fmt::Write; -use std::fs::{self, File}; -use std::path::Path; -use std::sync::Arc; -use std::sync::Mutex; fn setup_http() -> TestRegistry { RegistryBuilder::new().http_index().build() diff --git a/tests/testsuite/registry_auth.rs b/tests/testsuite/registry_auth.rs index 02dfb02c571..49ff7efa2c9 100644 --- a/tests/testsuite/registry_auth.rs +++ b/tests/testsuite/registry_auth.rs @@ -1,6 +1,7 @@ //! Tests for registry authentication. use cargo_test_support::compare::assert_e2e; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Package, RegistryBuilder, Token}; use cargo_test_support::str; use cargo_test_support::{project, Execs, Project}; diff --git a/tests/testsuite/registry_overlay.rs b/tests/testsuite/registry_overlay.rs index 20bb0a1e73f..f1bdf571796 100644 --- a/tests/testsuite/registry_overlay.rs +++ b/tests/testsuite/registry_overlay.rs @@ -1,5 +1,6 @@ //! Tests for local-registry sources. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::{Package, RegistryBuilder, TestRegistry}; diff --git a/tests/testsuite/rename_deps.rs b/tests/testsuite/rename_deps.rs index 06d9907a7d7..8ba457d2547 100644 --- a/tests/testsuite/rename_deps.rs +++ b/tests/testsuite/rename_deps.rs @@ -2,6 +2,7 @@ use cargo_test_support::git; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Package}; use cargo_test_support::{basic_manifest, project, str}; diff --git a/tests/testsuite/replace.rs b/tests/testsuite/replace.rs index d2d0aa48cba..c65f10fb504 100644 --- a/tests/testsuite/replace.rs +++ b/tests/testsuite/replace.rs @@ -2,6 +2,7 @@ use cargo_test_support::git; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, project, str}; diff --git a/tests/testsuite/required_features.rs b/tests/testsuite/required_features.rs index 787c3e1f117..2a193ed0536 100644 --- a/tests/testsuite/required_features.rs +++ b/tests/testsuite/required_features.rs @@ -5,6 +5,7 @@ use cargo_test_support::install::{ }; use cargo_test_support::is_nightly; use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index de981df4704..931e9040c6e 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -1,5 +1,6 @@ //! Tests for the `cargo run` command. +use cargo_test_support::prelude::*; use cargo_test_support::{ basic_bin_manifest, basic_lib_manifest, basic_manifest, project, str, Project, }; diff --git a/tests/testsuite/rustc_info_cache.rs b/tests/testsuite/rustc_info_cache.rs index 0b67d091a4f..91cb6a05afb 100644 --- a/tests/testsuite/rustc_info_cache.rs +++ b/tests/testsuite/rustc_info_cache.rs @@ -1,8 +1,10 @@ //! Tests for the cache file for the rustc version info. +use std::env; + +use cargo_test_support::prelude::*; use cargo_test_support::{basic_bin_manifest, paths::CargoPathExt}; use cargo_test_support::{basic_manifest, project}; -use std::env; const MISS: &str = "[..] rustc info cache miss[..]"; const HIT: &str = "[..]rustc info cache hit[..]"; diff --git a/tests/testsuite/rustdoc.rs b/tests/testsuite/rustdoc.rs index 34a1f045129..3b46237e8bd 100644 --- a/tests/testsuite/rustdoc.rs +++ b/tests/testsuite/rustdoc.rs @@ -1,5 +1,6 @@ //! Tests for the `cargo rustdoc` command. +use cargo_test_support::prelude::*; use cargo_test_support::str; use cargo_test_support::{basic_manifest, cross_compile, project}; diff --git a/tests/testsuite/rustdoc_extern_html.rs b/tests/testsuite/rustdoc_extern_html.rs index 32b8a764339..0f116a20fef 100644 --- a/tests/testsuite/rustdoc_extern_html.rs +++ b/tests/testsuite/rustdoc_extern_html.rs @@ -1,5 +1,6 @@ //! Tests for the -Zrustdoc-map feature. +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Package}; use cargo_test_support::{paths, project, str, Project}; diff --git a/tests/testsuite/rustdocflags.rs b/tests/testsuite/rustdocflags.rs index 1ab834567eb..c0692023154 100644 --- a/tests/testsuite/rustdocflags.rs +++ b/tests/testsuite/rustdocflags.rs @@ -1,5 +1,6 @@ //! Tests for setting custom rustdoc flags. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::rustc_host; use cargo_test_support::rustc_host_env; diff --git a/tests/testsuite/rustflags.rs b/tests/testsuite/rustflags.rs index 9ecc2995729..81ce4c3aef3 100644 --- a/tests/testsuite/rustflags.rs +++ b/tests/testsuite/rustflags.rs @@ -1,8 +1,10 @@ //! Tests for setting custom rustc flags. +use std::fs; + +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, paths, project, project_in_home, rustc_host, str}; -use std::fs; #[cargo_test] fn env_rustflags_normal_source() { diff --git a/tests/testsuite/rustup.rs b/tests/testsuite/rustup.rs index f04e51ecb51..7e0670a4b8d 100644 --- a/tests/testsuite/rustup.rs +++ b/tests/testsuite/rustup.rs @@ -1,13 +1,15 @@ //! Tests for Cargo's behavior under Rustup. -use cargo_test_support::paths::{home, root, CargoPathExt}; -use cargo_test_support::{cargo_process, process, project, str}; use std::env; use std::env::consts::EXE_EXTENSION; use std::ffi::OsString; use std::fs; use std::path::{Path, PathBuf}; +use cargo_test_support::paths::{home, root, CargoPathExt}; +use cargo_test_support::prelude::*; +use cargo_test_support::{cargo_process, process, project, str}; + /// Helper to generate an executable. fn make_exe(dest: &Path, name: &str, contents: &str, env: &[(&str, PathBuf)]) -> PathBuf { let rs_name = format!("{name}.rs"); diff --git a/tests/testsuite/search.rs b/tests/testsuite/search.rs index 391d10c0b41..55b74459c94 100644 --- a/tests/testsuite/search.rs +++ b/tests/testsuite/search.rs @@ -1,11 +1,13 @@ //! Tests for the `cargo search` command. +use std::collections::HashSet; + use cargo::util::cache_lock::CacheLockMode; use cargo_test_support::cargo_process; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{RegistryBuilder, Response}; use cargo_test_support::str; -use std::collections::HashSet; const SEARCH_API_RESPONSE: &[u8] = br#" { diff --git a/tests/testsuite/shell_quoting.rs b/tests/testsuite/shell_quoting.rs index bd4355fdab5..d5d6800d5b2 100644 --- a/tests/testsuite/shell_quoting.rs +++ b/tests/testsuite/shell_quoting.rs @@ -2,6 +2,7 @@ //! in the output, their arguments are quoted properly //! so that the command can be run in a terminal. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::str; diff --git a/tests/testsuite/source_replacement.rs b/tests/testsuite/source_replacement.rs index 16ac29f1340..72224da395c 100644 --- a/tests/testsuite/source_replacement.rs +++ b/tests/testsuite/source_replacement.rs @@ -2,6 +2,7 @@ use std::fs; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Package, RegistryBuilder, TestRegistry}; use cargo_test_support::{cargo_process, paths, project, str, t}; diff --git a/tests/testsuite/ssh.rs b/tests/testsuite/ssh.rs index 5da976991e7..0be63e79055 100644 --- a/tests/testsuite/ssh.rs +++ b/tests/testsuite/ssh.rs @@ -5,13 +5,15 @@ //! //! NOTE: The container tests almost certainly won't work on Windows. -use cargo_test_support::containers::{Container, ContainerHandle, MkFile}; -use cargo_test_support::git::cargo_uses_gitoxide; -use cargo_test_support::{paths, process, project, str, Project}; use std::fs; use std::io::Write; use std::path::PathBuf; +use cargo_test_support::containers::{Container, ContainerHandle, MkFile}; +use cargo_test_support::git::cargo_uses_gitoxide; +use cargo_test_support::prelude::*; +use cargo_test_support::{paths, process, project, str, Project}; + fn ssh_repo_url(container: &ContainerHandle, name: &str) -> String { let port = container.port_mappings[&22]; format!("ssh://testuser@127.0.0.1:{port}/repos/{name}.git") diff --git a/tests/testsuite/standard_lib.rs b/tests/testsuite/standard_lib.rs index 863631a00a6..5ad7f8056d8 100644 --- a/tests/testsuite/standard_lib.rs +++ b/tests/testsuite/standard_lib.rs @@ -4,10 +4,12 @@ //! rebuild the real one. There is a separate integration test `build-std` //! which builds the real thing, but that should be avoided if possible. +use std::path::{Path, PathBuf}; + +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::ProjectBuilder; use cargo_test_support::{paths, project, rustc_host, str, Execs}; -use std::path::{Path, PathBuf}; struct Setup { rustc_wrapper: PathBuf, diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 9c05db55f28..0ed64e9e7e2 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo test` command. +use std::fs; + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; @@ -9,7 +11,6 @@ use cargo_test_support::{ use cargo_test_support::{cross_compile, paths}; use cargo_test_support::{rustc_host, rustc_host_env, sleep_ms}; use cargo_util::paths::dylib_path_envvar; -use std::fs; #[cargo_test] fn cargo_test_simple() { diff --git a/tests/testsuite/timings.rs b/tests/testsuite/timings.rs index 7de91df89f3..27083bd7a77 100644 --- a/tests/testsuite/timings.rs +++ b/tests/testsuite/timings.rs @@ -1,5 +1,6 @@ //! Tests for --timings. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; diff --git a/tests/testsuite/tool_paths.rs b/tests/testsuite/tool_paths.rs index 843910402d5..b733d6f9b1d 100644 --- a/tests/testsuite/tool_paths.rs +++ b/tests/testsuite/tool_paths.rs @@ -1,5 +1,6 @@ //! Tests for configuration values that point to programs. +use cargo_test_support::prelude::*; use cargo_test_support::{basic_lib_manifest, project, rustc_host, rustc_host_env, str}; #[cargo_test] diff --git a/tests/testsuite/tree.rs b/tests/testsuite/tree.rs index 0fd30a55486..fff80b28271 100644 --- a/tests/testsuite/tree.rs +++ b/tests/testsuite/tree.rs @@ -1,11 +1,13 @@ //! Tests for the `cargo tree` command. -use super::features2::switch_to_resolver_2; use cargo_test_support::cross_compile::{self, alternate}; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::str; use cargo_test_support::{basic_manifest, git, project, rustc_host, Project}; +use super::features2::switch_to_resolver_2; + fn make_simple_proj() -> Project { Package::new("c", "1.0.0").publish(); Package::new("b", "1.0.0").dep("c", "1.0").publish(); diff --git a/tests/testsuite/tree_graph_features.rs b/tests/testsuite/tree_graph_features.rs index 34db61cc2ca..313afa72c5e 100644 --- a/tests/testsuite/tree_graph_features.rs +++ b/tests/testsuite/tree_graph_features.rs @@ -1,5 +1,6 @@ //! Tests for the `cargo tree` command with -e features option. +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::str; diff --git a/tests/testsuite/verify_project.rs b/tests/testsuite/verify_project.rs index 974c361173f..a02994da4da 100644 --- a/tests/testsuite/verify_project.rs +++ b/tests/testsuite/verify_project.rs @@ -1,5 +1,6 @@ //! Tests for the `cargo verify-project` command. +use cargo_test_support::prelude::*; use cargo_test_support::{basic_bin_manifest, main_file, project, str}; #[cargo_test] diff --git a/tests/testsuite/version.rs b/tests/testsuite/version.rs index f9e49a64dda..83f2d2b78e8 100644 --- a/tests/testsuite/version.rs +++ b/tests/testsuite/version.rs @@ -1,5 +1,6 @@ //! Tests for displaying the cargo version. +use cargo_test_support::prelude::*; use cargo_test_support::{cargo_process, project}; #[cargo_test] diff --git a/tests/testsuite/warn_on_failure.rs b/tests/testsuite/warn_on_failure.rs index adcad310e10..04cb9dc833f 100644 --- a/tests/testsuite/warn_on_failure.rs +++ b/tests/testsuite/warn_on_failure.rs @@ -1,5 +1,6 @@ //! Tests for whether or not warnings are displayed for build scripts. +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::{project, str, Project}; diff --git a/tests/testsuite/weak_dep_features.rs b/tests/testsuite/weak_dep_features.rs index da281bfe32f..715b7b6b2fd 100644 --- a/tests/testsuite/weak_dep_features.rs +++ b/tests/testsuite/weak_dep_features.rs @@ -1,11 +1,14 @@ //! Tests for weak-dep-features. -use super::features2::switch_to_resolver_2; +use std::fmt::Write; + use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{Dependency, Package, RegistryBuilder}; use cargo_test_support::str; use cargo_test_support::{project, publish}; -use std::fmt::Write; + +use super::features2::switch_to_resolver_2; // Helper to create lib.rs files that check features. fn require(enabled_features: &[&str], disabled_features: &[&str]) -> String { diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index f830a09f0ea..58ba3bc26bc 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -1,10 +1,12 @@ //! Tests for workspaces. +use std::env; +use std::fs; + +use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::str; use cargo_test_support::{basic_lib_manifest, basic_manifest, git, project, sleep_ms}; -use std::env; -use std::fs; #[cargo_test] fn simple_explicit() { diff --git a/tests/testsuite/yank.rs b/tests/testsuite/yank.rs index 58c82e048e8..4d068c84aa4 100644 --- a/tests/testsuite/yank.rs +++ b/tests/testsuite/yank.rs @@ -3,6 +3,7 @@ use std::fs; use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry; use cargo_test_support::str; From e2e2f311aa260f52e798c2f295f009f2c03eea04 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 12 Jul 2024 08:28:13 -0500 Subject: [PATCH 3/3] docs(contrib): Note reqirement for prelude --- src/doc/contrib/src/tests/writing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/doc/contrib/src/tests/writing.md b/src/doc/contrib/src/tests/writing.md index 6072ee83818..8994dd3f945 100644 --- a/src/doc/contrib/src/tests/writing.md +++ b/src/doc/contrib/src/tests/writing.md @@ -30,6 +30,8 @@ stdout and stderr output against the expected output. Generally, a functional test will be placed in `tests/testsuite/.rs` and will look roughly like: ```rust,ignore +use cargo_test_support::prelude::*; + #[cargo_test] fn () { let p = project()