rust-lang / rust-lang/rust-clippy

`clippy::wildcard_dependencies` message doesn't indicate the source file with the error

Open
#11,409 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Description

Error when wildcard dependency is flagged doesn't tell you where the offending dependency was found.
It does tell you which dependency to grep for, however.

Repro:

> cat Cargo.toml
[package]
name = "sub_pop"
version = "0.1.0"
edition = "2021"

[dependencies]
test_crate_test = "*"


> cargo clippy
    Checking sub_pop v0.1.0 (/home/bobhy/src/rust/wc_dep/crates/sub_pop)
error: wildcard dependency for `test_crate_test`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_dependencies
  = note: requested on the command line with `-D clippy::wildcard-dependencies`

error: could not compile `sub_pop` (lib) due to previous error

You could argue that the "could not compile" points the finger, but this line isn't accurate when the workspace contains multiple crates. What I'd like is a specific source file and line number.

Version
rustc 1.71.1 (eb26296b5 2023-08-03)
binary: rustc
commit-hash: eb26296b556cef10fb713a38f3d16b9886080f26
commit-date: 2023-08-03
host: x86_64-unknown-linux-gnu
release: 1.71.1
LLVM version: 16.0.5
Additional Labels

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the clippy::wildcard_dependencies lint and reproduce the report with the Cargo.toml example in the issue. Trace how the lint emits its diagnostic, then make the completed diagnostic identify the relevant Cargo.toml path and line for the offending dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.