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

Spurious semicolon inside closure is not idempotent #6116

Open
Kyuuhachi opened this issue Mar 14, 2024 · 1 comment
Open

Spurious semicolon inside closure is not idempotent #6116

Kyuuhachi opened this issue Mar 14, 2024 · 1 comment
Assignees
Labels
bug Panic, non-idempotency, invalid code, etc. p-low

Comments

@Kyuuhachi
Copy link

Kyuuhachi commented Mar 14, 2024

Consider the following snippet.

fn foo() -> fn(i32) -> i32 {
    |a| {
        ;
        a
    }
}

Rustfmt starts by removing that spurious semicolon.

fn foo() -> fn(i32) -> i32 {
    |a| {
        a
    }
}

If run again, it notices that the closure fits on one line.

fn foo() -> fn(i32) -> i32 {
    |a| a
}
@ytmimi ytmimi added bug Panic, non-idempotency, invalid code, etc. p-low labels Mar 14, 2024
@rscprof
Copy link

rscprof commented Mar 29, 2024

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. p-low
Projects
None yet
Development

No branches or pull requests

3 participants