Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(add): Ensure users know a feature is being created #13434

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cargo/ops/cargo_add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
let new_feature: toml_edit::Value =
[format!("dep:{dep_name}")].iter().collect();
table[dep_key] = toml_edit::value(new_feature);
options
.config
.shell()
.status("Adding", format!("feature `{dep_key}`"))?;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/change_rename_target/stderr.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package2 v99999.0.0 to optional dependencies.
Adding feature `some-package`
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Adding foo (workspace) to optional dependencies.
Adding feature `foo`
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/optional/stderr.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package v0.1.0 to optional dependencies.
Adding feature `my-package`
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Adding cargo-list-test-fixture-dependency (local) to optional dependencies.
Adding feature `cargo-list-test-fixture-dependency`
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Adding foo (workspace) to optional dependencies.
Adding feature `foo`
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/overwrite_name_noop/stderr.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Features:
+ mouth
+ nose
Adding feature `your-face`
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package v0.1.0 to optional dependencies.
Adding feature `my-package`
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/overwrite_optional/stderr.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package v0.1.0 to optional dependencies.
Adding feature `my-package`
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/overwrite_path_noop/stderr.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Features:
+ mouth
+ nose
Adding feature `your-face`
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding cargo-list-test-fixture-dependency v20.0 to optional dependencies.
Adding feature `cargo-list-test-fixture-dependency`
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding versioned-package v0.1.1 to optional dependencies.
Adding feature `a1`
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Updating git repository `[ROOTURL]/versioned-package`
Adding versioned-package (git) to optional dependencies.
Adding feature `versioned-package`
Updating git repository `[ROOTURL]/versioned-package`
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Adding cargo-list-test-fixture-dependency (local) to optional dependencies.
Adding feature `cargo-list-test-fixture-dependency`
Loading