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

Let-Else is not formated correctly after else #5660

Closed
erwanvivien opened this issue Jan 16, 2023 · 2 comments
Closed

Let-Else is not formated correctly after else #5660

erwanvivien opened this issue Jan 16, 2023 · 2 comments

Comments

@erwanvivien
Copy link

fn main() {
    let position:      Option<usize> = None;
    let mut normal: Option<usize> =  None;
    let mut tex_coords: Option<usize>    = None;

    let (Some( position), Some(    normal), Some(tex_coords  )) = (position, normal, tex_coords) else {
        return;
 };
 }

Does not format the let-else at all, resulting in:

fn main() {
    let position: Option<usize> = None;
    let mut normal: Option<usize> = None;
    let mut tex_coords: Option<usize> = None;

    let (Some( position), Some(    normal), Some(tex_coords  )) = (position, normal, tex_coords) else {
        return;
 };

}
# How to reproduce
$ rustfmt .\src\main.rs

Version:

$ rustfmt --version
rustfmt 1.5.1-stable (897e3755 2022-11-02)
@ytmimi
Copy link
Contributor

ytmimi commented Jan 16, 2023

Thanks for reaching out!

rustfmt doesn't support formatting let-else as the rules for how they should be formatted were not decided until about 2 weeks ago. You can check out rust-lang/style-team#165 (comment) for more details. Support for let-else formatting will be added in a future release.

To be notified when let-else support is added you can follow tracking issue #4914

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2023
@erwanvivien
Copy link
Author

Alright, thanks :)

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