Skip to content

unnecessary_wraps: Annoyingly large span #14773

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

Open
TimNN opened this issue May 10, 2025 · 1 comment · May be fixed by #14777
Open

unnecessary_wraps: Annoyingly large span #14773

TimNN opened this issue May 10, 2025 · 1 comment · May be fixed by #14777
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@TimNN
Copy link
Contributor

TimNN commented May 10, 2025

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

@samueltardieu
Copy link
Contributor

Seems like a reasonable request.

@rustbot label +C-enhancement
@rustbot claim

@rustbot rustbot added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants