Skip to content

Commit a49921f

Browse files
committed
fix(test)!: Clarify extension trait role with rename
When browsing the docs, I feel like this will make it easier to tell the role of these traits within the API. Or in other words, I can easily tell that these fill a support role and for what, so I know when I care to look into them. We use this naming pattern for `cargo_test_support::paths::CargoPathExt`.
1 parent f10c069 commit a49921f

File tree

52 files changed

+66
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+66
-66
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ pub mod tools;
7575
pub mod prelude {
7676
pub use crate::cargo_test;
7777
pub use crate::paths::CargoPathExt;
78-
pub use crate::ArgLine;
79-
pub use crate::CargoCommand;
80-
pub use crate::ChannelChanger;
81-
pub use crate::TestEnv;
78+
pub use crate::ArgLineCommandExt;
79+
pub use crate::CargoCommandExt;
80+
pub use crate::ChannelChangerCommandExt;
81+
pub use crate::TestEnvCommandExt;
8282
pub use snapbox::IntoData;
8383
}
8484

@@ -1247,27 +1247,27 @@ fn _process(t: &OsStr) -> ProcessBuilder {
12471247
}
12481248

12491249
/// Enable nightly features for testing
1250-
pub trait ChannelChanger {
1250+
pub trait ChannelChangerCommandExt {
12511251
/// The list of reasons should be why nightly cargo is needed. If it is
12521252
/// because of an unstable feature put the name of the feature as the reason,
12531253
/// e.g. `&["print-im-a-teapot"]`.
12541254
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self;
12551255
}
12561256

1257-
impl ChannelChanger for &mut ProcessBuilder {
1257+
impl ChannelChangerCommandExt for &mut ProcessBuilder {
12581258
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self {
12591259
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
12601260
}
12611261
}
12621262

1263-
impl ChannelChanger for snapbox::cmd::Command {
1263+
impl ChannelChangerCommandExt for snapbox::cmd::Command {
12641264
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self {
12651265
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
12661266
}
12671267
}
12681268

12691269
/// Establish a process's test environment
1270-
pub trait TestEnv: Sized {
1270+
pub trait TestEnvCommandExt: Sized {
12711271
fn test_env(mut self) -> Self {
12721272
// In general just clear out all cargo-specific configuration already in the
12731273
// environment. Our tests all assume a "default configuration" unless
@@ -1357,7 +1357,7 @@ pub trait TestEnv: Sized {
13571357
fn env_remove(self, key: &str) -> Self;
13581358
}
13591359

1360-
impl TestEnv for &mut ProcessBuilder {
1360+
impl TestEnvCommandExt for &mut ProcessBuilder {
13611361
fn current_dir<S: AsRef<std::path::Path>>(self, path: S) -> Self {
13621362
let path = path.as_ref();
13631363
self.cwd(path)
@@ -1370,7 +1370,7 @@ impl TestEnv for &mut ProcessBuilder {
13701370
}
13711371
}
13721372

1373-
impl TestEnv for snapbox::cmd::Command {
1373+
impl TestEnvCommandExt for snapbox::cmd::Command {
13741374
fn current_dir<S: AsRef<std::path::Path>>(self, path: S) -> Self {
13751375
self.current_dir(path)
13761376
}
@@ -1383,11 +1383,11 @@ impl TestEnv for snapbox::cmd::Command {
13831383
}
13841384

13851385
/// Test the cargo command
1386-
pub trait CargoCommand {
1386+
pub trait CargoCommandExt {
13871387
fn cargo_ui() -> Self;
13881388
}
13891389

1390-
impl CargoCommand for snapbox::cmd::Command {
1390+
impl CargoCommandExt for snapbox::cmd::Command {
13911391
fn cargo_ui() -> Self {
13921392
Self::new(cargo_exe())
13931393
.with_assert(compare::assert_ui())
@@ -1397,7 +1397,7 @@ impl CargoCommand for snapbox::cmd::Command {
13971397
}
13981398

13991399
/// Add a list of arguments as a line
1400-
pub trait ArgLine: Sized {
1400+
pub trait ArgLineCommandExt: Sized {
14011401
fn arg_line(mut self, s: &str) -> Self {
14021402
for mut arg in s.split_whitespace() {
14031403
if (arg.starts_with('"') && arg.ends_with('"'))
@@ -1415,13 +1415,13 @@ pub trait ArgLine: Sized {
14151415
fn arg<S: AsRef<std::ffi::OsStr>>(self, s: S) -> Self;
14161416
}
14171417

1418-
impl ArgLine for &mut ProcessBuilder {
1418+
impl ArgLineCommandExt for &mut ProcessBuilder {
14191419
fn arg<S: AsRef<std::ffi::OsStr>>(self, s: S) -> Self {
14201420
self.arg(s)
14211421
}
14221422
}
14231423

1424-
impl ArgLine for snapbox::cmd::Command {
1424+
impl ArgLineCommandExt for snapbox::cmd::Command {
14251425
fn arg<S: AsRef<std::ffi::OsStr>>(self, s: S) -> Self {
14261426
self.arg(s)
14271427
}

tests/testsuite/cargo_bench/no_keep_going/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use cargo_test_support::current_dir;
22
use cargo_test_support::file;
33
use cargo_test_support::prelude::*;
44
use cargo_test_support::str;
5-
use cargo_test_support::CargoCommand;
5+
use cargo_test_support::CargoCommandExt;
66
use cargo_test_support::Project;
77

88
#[cargo_test]

tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_non_workspace/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_format_previous_items/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_format_sorted/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_absolute_package_path/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_empty_members/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_members_glob/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

0 commit comments

Comments
 (0)