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

feat(#152): add renamed configuration field #153

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jalil-salame
Copy link

@jalil-salame jalil-salame commented Feb 13, 2025

This adds a renamed field that allows to map a dependency name to a crate name without using cargo metadata.

For example:

[dependencies]
rustls-webpki = "0.102.8"

[package.metadata.cargo-machete.renamed]
rustls-webpki = "webpki"

This allows cargo machete to correctly mark rustls-webpki as used if a use webpki or webpki::UsedItem is found in the codebase.

Closes #152


The code was easier to navigate than I expected, this is a draft so that an early review can confirm the approach is roughly correct, I still need to:

  • Ensure workspace Cargo.toml works (this should be very useful)
  • Document the changes
  • Ensure the test coverage is good enough.

This adds a `renamed` field that allows to map a dependency name to a
crate name without using `cargo metadata`.

For example:

```toml
[dependencies]
rustls-webpki = "0.102.8"

[package.metadata.cargo-machete.renamed]
rustls-webpki = "webpki"
```

This allows cargo machete to correctly mark `rustls-webpki` as used if a
`use webpki` or `webpki::UsedItem` is found in the codebase.
Also add an entry to the changelog.
@jalil-salame jalil-salame marked this pull request as ready for review February 15, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a *.metadata.cargo-machete.renamed field to configure renamed crates
1 participant