Skip to content

Commit 53b5a58

Browse files
committed
Auto merge of #13434 - epage:add-features, r=weihanglo
fix(add): Ensure users know a feature is being created Inspired by #13430 and #13411
2 parents 9d23d30 + 877b8e4 commit 53b5a58

File tree

14 files changed

+17
-0
lines changed

14 files changed

+17
-0
lines changed

src/cargo/ops/cargo_add/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
208208
let new_feature: toml_edit::Value =
209209
[format!("dep:{dep_name}")].iter().collect();
210210
table[dep_key] = toml_edit::value(new_feature);
211+
options
212+
.config
213+
.shell()
214+
.status("Adding", format!("feature `{dep_key}`"))?;
211215
}
212216
}
213217
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Updating `dummy-registry` index
22
Adding my-package2 v99999.0.0 to optional dependencies.
3+
Adding feature `some-package`
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Adding foo (workspace) to optional dependencies.
2+
Adding feature `foo`
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Updating `dummy-registry` index
22
Adding my-package v0.1.0 to optional dependencies.
3+
Adding feature `my-package`
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Adding cargo-list-test-fixture-dependency (local) to optional dependencies.
2+
Adding feature `cargo-list-test-fixture-dependency`
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Adding foo (workspace) to optional dependencies.
2+
Adding feature `foo`

tests/testsuite/cargo_add/overwrite_name_noop/stderr.log

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
Features:
33
+ mouth
44
+ nose
5+
Adding feature `your-face`
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Updating `dummy-registry` index
22
Adding my-package v0.1.0 to optional dependencies.
3+
Adding feature `my-package`
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Updating `dummy-registry` index
22
Adding my-package v0.1.0 to optional dependencies.
3+
Adding feature `my-package`

tests/testsuite/cargo_add/overwrite_path_noop/stderr.log

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
Features:
33
+ mouth
44
+ nose
5+
Adding feature `your-face`
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Updating `dummy-registry` index
22
Adding cargo-list-test-fixture-dependency v20.0 to optional dependencies.
3+
Adding feature `cargo-list-test-fixture-dependency`
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Updating `dummy-registry` index
22
Adding versioned-package v0.1.1 to optional dependencies.
3+
Adding feature `a1`
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Updating git repository `[ROOTURL]/versioned-package`
22
Adding versioned-package (git) to optional dependencies.
3+
Adding feature `versioned-package`
34
Updating git repository `[ROOTURL]/versioned-package`
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Adding cargo-list-test-fixture-dependency (local) to optional dependencies.
2+
Adding feature `cargo-list-test-fixture-dependency`

0 commit comments

Comments
 (0)