[go: up one dir, main page]

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

Incorrect indentation for match expression in match arm #3040

Closed
jdm opened this issue Sep 19, 2018 · 1 comment · Fixed by #3042
Closed

Incorrect indentation for match expression in match arm #3040

jdm opened this issue Sep 19, 2018 · 1 comment · Fixed by #3042

Comments

@jdm
Copy link
Contributor
jdm commented Sep 19, 2018

Before:

            DevtoolScriptControlMsg::WantsLiveNotifications(id, to_send) => {
                match documents.find_window(id) {
                    Some(window) => devtools::handle_wants_live_notifications(window.upcast(), to_send),
                    None => return warn!("Message sent to closed pipeline {}.", id),
                }
            }

After:

            DevtoolScriptControlMsg::WantsLiveNotifications(id, to_send) => match documents
                .find_window(id)
            {
                Some(window) => devtools::handle_wants_live_notifications(window.upcast(), to_send),
                None => return warn!("Message sent to closed pipeline {}.", id),
            },
@nrc
Copy link
Member
nrc commented Sep 20, 2018

Hmm, so ideally we'd do the first one. The decision Rustfmt is making is whether to use a block for a single statement or not. In this case, the two use the same number of lines. It would be better to select the first case here, but I'm not sure I can clearly state why. Given the choice to not use a block, I think the indentation is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants