File tree 3 files changed +19
-8
lines changed
3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ impl<'a> Prepare<'a> {
38
38
pub ( crate ) fn prepare ( & mut self ) -> Result < ( ) , Error > {
39
39
self . krate . copy_source_to ( self . workspace , self . source_dir ) ?;
40
40
self . validate_manifest ( ) ?;
41
- self . remove_cargo_config ( ) ?;
41
+ self . remove_override_files ( ) ?;
42
42
self . tweak_toml ( ) ?;
43
43
self . capture_lockfile ( false ) ?;
44
44
self . fetch_deps ( ) ?;
@@ -69,11 +69,17 @@ impl<'a> Prepare<'a> {
69
69
Ok ( ( ) )
70
70
}
71
71
72
- fn remove_cargo_config ( & self ) -> Result < ( ) , Error > {
73
- let path = self . source_dir . join ( ".cargo" ) . join ( "config" ) ;
74
- if path. exists ( ) {
75
- crate :: utils:: remove_file ( & path) ?;
76
- info ! ( "removed {}" , path. display( ) ) ;
72
+ fn remove_override_files ( & self ) -> Result < ( ) , Error > {
73
+ let paths = [
74
+ & Path :: new ( ".cargo" ) . join ( "config" ) ,
75
+ Path :: new ( "rust-toolchain" ) ,
76
+ ] ;
77
+ for path in & paths {
78
+ let path = self . source_dir . join ( path) ;
79
+ if path. exists ( ) {
80
+ crate :: utils:: remove_file ( & path) ?;
81
+ info ! ( "removed {}" , path. display( ) ) ;
82
+ }
77
83
}
78
84
Ok ( ( ) )
79
85
}
Original file line number Diff line number Diff line change
1
+ 1.0.0
Original file line number Diff line number Diff line change @@ -83,14 +83,18 @@ fn test_sandbox_oom() {
83
83
}
84
84
85
85
#[ test]
86
- fn test_cargo_config ( ) {
86
+ fn test_override_files ( ) {
87
87
runner:: run ( "cargo-config" , |run| {
88
88
run. build ( SandboxBuilder :: new ( ) . enable_networking ( false ) , |build| {
89
89
let storage = rustwide:: logging:: LogStorage :: new ( LevelFilter :: Info ) ;
90
90
rustwide:: logging:: capture ( & storage, || -> Result < _ , Error > {
91
- build. cargo ( ) . args ( & [ "run " ] ) . run ( ) ?;
91
+ build. cargo ( ) . args ( & [ "--version " ] ) . run ( ) ?;
92
92
Ok ( ( ) )
93
93
} ) ?;
94
+ let output = storage. to_string ( ) ;
95
+ assert ! ( output. contains( "cargo 1." ) ) ;
96
+ assert ! ( !output. contains( "1.0.0" ) ) ;
97
+ build. cargo ( ) . args ( & [ "run" ] ) . run ( ) ?;
94
98
Ok ( ( ) )
95
99
} ) ?;
96
100
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments