Repository navigation
Conversation
… underline For dependencies defined with table header syntax (e.g. `[dependencies.foo]`), the value span of the table covers the whole header including its closing `]`. The unused-dependency diagnostic underlined `key.start..value.end`, so the underline included a stray `]` (and, for non-empty tables, spanned the header bracket as well). Underline only the dependency key for header-defined tables; inline tables and plain key-value entries keep the full `key..value` span. Fixes rust-lang#17609 Signed-off-by: wqyuan <wqyuan@users.noreply.github.com>
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project has assigned @epage (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
This PR, as disclosed, was created with LLM assistance, but has no pre-arranged reviewers for LLM generated changes, so closing. |
Member
|
Also your PR activity seems to be LLM automation. This is not allowed in any repositories under rust-lang organization per our policies. We are thus restricting you from creating pull requests and comments. Thanks for your understanding. Weihang in the name of the mod team |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Fixes #17609
For dependencies defined with table header syntax (e.g.
[dependencies.foo]), the value span returned byget_key_valuecovers the whole table header, including its closing]. The unused-dependency diagnostic underlinedkey.start..value.end, so the underline dragged the stray]into the diagnostic:With this change, header-defined tables underline only the dependency key:
Inline tables (
foo = { .. }) and plain key-value entries (foo = "1.0") are unaffected and keep the fullkey..valuespan. The same fix is applied to both the normal-dependency and build-dependency call sites inunused_dependencies.rs.Notes to reviewers
The probe that motivated the detection rule: for a header-defined table the value span starts with
[(it covers the entire header), while for an inline table it starts with{.dep_underline_spankeys off that distinction.Verified locally:
cargo test --test testsuite lints::unused_dependencies— all 25 tests pass, including the newunused_dep_table_header_syntax.master(underline includes]) and passes with the fix.🤖 LLM involvement: An LLM assistant (Claude) was used to investigate the issue, draft the fix and the regression test, and prepare this PR. All code was reviewed and the tests were run locally by the author.