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

[Diagnostic ER] Missing unnecessary parentheses warning #96606

Closed
leonardo-m opened this issue May 1, 2022 · 1 comment · Fixed by #107539
Closed

[Diagnostic ER] Missing unnecessary parentheses warning #96606

leonardo-m opened this issue May 1, 2022 · 1 comment · Fixed by #107539
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

leonardo-m commented May 1, 2022

rustc could give a unnecessary parentheses warning here:

fn main() {
    let arr = [0; 10];
    let i = 2;
    let y = arr[(5 - i)];
    dbg!(y);
}
@Noratrieb Noratrieb added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 30, 2023
@PossiblyAShrub
Copy link
Contributor

@rustbot claim

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Feb 3, 2023
…dex, r=lcnr

Emit warnings on unused parens in index expressions

Fixes: rust-lang#96606.

I am not sure what the best term for "index expression" is. Is there a better term we could use?
@bors bors closed this as completed in d9db357 Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants