File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed
crates/cargo-test-support/src Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ pub mod publish;
59
59
pub mod registry;
60
60
pub mod tools;
61
61
62
+ pub mod prelude {
63
+ pub use crate :: ChannelChanger ;
64
+ }
65
+
62
66
/*
63
67
*
64
68
* ===== Builders =====
@@ -1169,12 +1173,19 @@ fn _process(t: &OsStr) -> ProcessBuilder {
1169
1173
p
1170
1174
}
1171
1175
1172
- pub trait ChannelChanger : Sized {
1173
- fn masquerade_as_nightly_cargo ( & mut self ) -> & mut Self ;
1176
+ /// Enable nightly features for testing
1177
+ pub trait ChannelChanger {
1178
+ fn masquerade_as_nightly_cargo ( self ) -> Self ;
1179
+ }
1180
+
1181
+ impl ChannelChanger for & mut ProcessBuilder {
1182
+ fn masquerade_as_nightly_cargo ( self ) -> Self {
1183
+ self . env ( "__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS" , "nightly" )
1184
+ }
1174
1185
}
1175
1186
1176
- impl ChannelChanger for ProcessBuilder {
1177
- fn masquerade_as_nightly_cargo ( & mut self ) -> & mut Self {
1187
+ impl ChannelChanger for snapbox :: cmd :: Command {
1188
+ fn masquerade_as_nightly_cargo ( self ) -> Self {
1178
1189
self . env ( "__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS" , "nightly" )
1179
1190
}
1180
1191
}
Original file line number Diff line number Diff line change 1
1
use cargo_test_support:: cargo_exe;
2
2
use cargo_test_support:: compare:: assert;
3
+ use cargo_test_support:: prelude:: * ;
3
4
use cargo_test_support:: Project ;
4
5
5
6
pub fn cargo_command ( ) -> snapbox:: cmd:: Command {
@@ -50,16 +51,6 @@ pub fn cargo_command() -> snapbox::cmd::Command {
50
51
cmd
51
52
}
52
53
53
- pub trait CommandExt {
54
- fn masquerade_as_nightly_cargo ( self ) -> Self ;
55
- }
56
-
57
- impl CommandExt for snapbox:: cmd:: Command {
58
- fn masquerade_as_nightly_cargo ( self ) -> Self {
59
- self . env ( "__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS" , "nightly" )
60
- }
61
- }
62
-
63
54
fn init_registry ( ) {
64
55
cargo_test_support:: registry:: init ( ) ;
65
56
add_registry_packages ( false ) ;
You can’t perform that action at this time.
0 commit comments