Is there a lint for shadowed label names?

I'm writing code that generates a lot of these warnings:

warning: label name 'ret shadows a label name that is already in scope.

and I would prefer that they not appear. Is there an allow() lint to suppress them? I've looked and I can't seem to find anything for this warning. Thanks!

Doesn't look like there is a way to allow them

1 Like

This sounds like a lint that should be added to clippy because you aren't the first person asking for this sort of lint.

Are you able to create an issue against the clippy repo?

2 Likes

it looks like this isn't possible at the moment; however, there's already a tracking issue open for this problem: Label shadowing causes a warning that cannot be allowed · Issue #65269 · rust-lang/rust · GitHub

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.