Skip to content
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

New lint to detect usage of [args @ ..] #11011

Closed
Centri3 opened this issue Jun 23, 2023 · 0 comments · Fixed by #11013
Closed

New lint to detect usage of [args @ ..] #11011

Centri3 opened this issue Jun 23, 2023 · 0 comments · Fixed by #11013
Assignees
Labels
A-lint Area: New lints

Comments

@Centri3
Copy link
Member

Centri3 commented Jun 23, 2023

What it does

Detects usage of [args @ ..] and suggests switching it to args.

Can probably be named redundant_rest_pattern.

@rustbot claim

Advantage

  • Is clearer; a 1-len slice with a rest pattern is(should be) identical to just args.

Drawbacks

None.

Example

if let Some([args @ ..]) = init { ... }

Could be written as:

if let Some(args) = init { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant