Skip to content

unnecessary_wraps: Annoyingly large span #14773

Open
@TimNN

Description

@TimNN

Description

If the unnecessary_wraps lint triggers, it highlights the entire function (in Rust Analyzer + VS Code at least).

I find this quite annoying: When I'm implementing a new function it can take a bit until I get to the part that can actually fail and return an error. Adding yellow squiggles to the entire function is quite distracting and also obscures other potential warnings:

Image

Proposal:

  • Reduce amount of code highlighted. I'm not sure how exactly that works, but maybe the primary span could point only at the result type or the function signature>
  • At least inhibit the lint in the presence of todo!()

Version

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: aarch64-apple-darwin
release: 1.86.0
LLVM version: 19.1.7

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions