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

Extra spaces not removed in let-else statements #5585

Closed
adamchalmers opened this issue Nov 3, 2022 · 1 comment
Closed

Extra spaces not removed in let-else statements #5585

adamchalmers opened this issue Nov 3, 2022 · 1 comment

Comments

@adamchalmers
Copy link

I think this is a bug. Consider this program playground

fn main() {
    let x: Option<i32> = None;
    let Some(y) = x       else {
        return;
    };
    println!("{y}");
}

I think the extra spaces on line 3, between x and else, should be removed by rustfmt. But on current stable they aren't.

@ytmimi
Copy link
Contributor

ytmimi commented Nov 3, 2022

Thanks for reaching out. rustfmt doesn't handle let-else formatting because the rules for how it should be formatted are still being discussed in rust-lang/style-team#165

You might also want to follow #4914 to keep track of the implementation on the rustfmt side once the rules have been codified in the fmt-rfc linked above.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants