File tree 8 files changed +58
-2
lines changed
tests/testsuite/cargo_remove
8 files changed +58
-2
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,6 @@ fn gc_workspace(workspace: &Workspace<'_>) -> CargoResult<()> {
216
216
//
217
217
// Example tables:
218
218
// - profile.dev.package.foo
219
- // - profile.release.package."*"
220
219
// - profile.release.package."foo:2.1.0"
221
220
if let Some ( toml_edit:: Item :: Table ( profile_section_table) ) = manifest. get_mut ( "profile" ) {
222
221
profile_section_table. set_implicit ( true ) ;
@@ -231,8 +230,14 @@ fn gc_workspace(workspace: &Workspace<'_>) -> CargoResult<()> {
231
230
package_table. set_implicit ( true ) ;
232
231
233
232
for ( key, item) in package_table. iter_mut ( ) {
233
+ let key = key. get ( ) ;
234
+ // Skip globs. Can't do anything with them.
235
+ // For example, profile.release.package."*".
236
+ if crate :: util:: restricted_names:: is_glob_pattern ( key) {
237
+ continue ;
238
+ }
234
239
if !spec_has_match (
235
- & PackageIdSpec :: parse ( key. get ( ) ) ?,
240
+ & PackageIdSpec :: parse ( key) ?,
236
241
& dependencies,
237
242
workspace. config ( ) ,
238
243
) ? {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ mod optional_dep_feature;
23
23
mod optional_feature;
24
24
mod package;
25
25
mod remove_basic;
26
+ mod skip_gc_glob_profile;
26
27
mod target;
27
28
mod target_build;
28
29
mod target_dev;
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " cargo-remove-test-fixture"
3
+ version = " 0.1.0"
4
+
5
+ [[bin ]]
6
+ name = " main"
7
+ path = " src/main.rs"
8
+
9
+ [dependencies ]
10
+ toml = " 0.1"
11
+
12
+ [profile .dev .package ."*" ]
13
+ opt-level = 3
Original file line number Diff line number Diff line change
1
+
Original file line number Diff line number Diff line change
1
+ use cargo_test_support:: compare:: assert_ui;
2
+ use cargo_test_support:: curr_dir;
3
+ use cargo_test_support:: CargoCommand ;
4
+ use cargo_test_support:: Project ;
5
+
6
+ #[ cargo_test]
7
+ fn case ( ) {
8
+ cargo_test_support:: registry:: init ( ) ;
9
+ cargo_test_support:: registry:: Package :: new ( "toml" , "0.1.1+my-package" ) . publish ( ) ;
10
+
11
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
12
+ let project_root = project. root ( ) ;
13
+ let cwd = & project_root;
14
+
15
+ snapbox:: cmd:: Command :: cargo_ui ( )
16
+ . arg ( "remove" )
17
+ . args ( [ "toml" ] )
18
+ . current_dir ( cwd)
19
+ . assert ( )
20
+ . success ( )
21
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
22
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
23
+
24
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
25
+ }
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " cargo-remove-test-fixture"
3
+ version = " 0.1.0"
4
+
5
+ [[bin ]]
6
+ name = " main"
7
+ path = " src/main.rs"
8
+
9
+ [profile .dev .package ."*" ]
10
+ opt-level = 3
Original file line number Diff line number Diff line change
1
+ Removing toml from dependencies
You can’t perform that action at this time.
0 commit comments