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

Add a *.metadata.cargo-machete.renamed field to configure renamed crates #152

Open
jalil-salame opened this issue Jan 28, 2025 · 3 comments · May be fixed by #153
Open

Add a *.metadata.cargo-machete.renamed field to configure renamed crates #152

jalil-salame opened this issue Jan 28, 2025 · 3 comments · May be fixed by #153

Comments

@jalil-salame
Copy link

Having an explicit renamed field should help with false positives without using --with-metadata, in my employer's codebase we see more false positives with --with-metadata.

I would be willing to code this feature.

Example:

[package.metadata.cargo-machete.renamed]
# crate-name = "import-name"
rustls-webpki = "webpki"
@bnjbvr
Copy link
Owner

bnjbvr commented Feb 13, 2025

Thanks for proposing this. I think it's a good idea, and if you're happy to implement and document it, that would be awesome!

@jalil-salame

This comment has been minimized.

jalil-salame added a commit to jalil-salame/cargo-machete that referenced this issue 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:

```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.
@jalil-salame jalil-salame linked a pull request Feb 13, 2025 that will close this issue
3 tasks
@jalil-salame

This comment has been minimized.

jalil-salame added a commit to jalil-salame/cargo-machete that referenced this issue Feb 15, 2025
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.
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 a pull request may close this issue.

2 participants