Skip to content

Weird indentation for match arms in chain #1056

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

Closed
jdm opened this issue Jun 9, 2016 · 8 comments
Closed

Weird indentation for match arms in chain #1056

jdm opened this issue Jun 9, 2016 · 8 comments

Comments

@jdm
Copy link
Contributor

jdm commented Jun 9, 2016

fn default_user_agent_string(agent: UserAgent) -> String {
    match agent {
        UserAgent::Desktop => {
            DESKTOP_UA_STRING
        }
        UserAgent::Android => {
            "Mozilla/5.0 (Android; Mobile; rv:37.0) Servo/1.0 Firefox/37.0"
        }
    }.to_owned()
}

fn main() {}

yields

fn default_user_agent_string(agent: UserAgent) -> String {
    match agent {
            UserAgent::Desktop => DESKTOP_UA_STRING,
            UserAgent::Android => "Mozilla/5.0 (Android; Mobile; rv:37.0) Servo/1.0 Firefox/37.0",
        }
        .to_owned()
}

fn main() {} main() {}
@jdm
Copy link
Contributor Author

jdm commented Jun 9, 2016

It works fine if the .to_owned() isn't present in the original.

@nrc nrc added this to the 1.0 milestone Jun 10, 2016
@nrc nrc changed the title Weird indentation for match in expression position Weird indentation for match arms in chain Jun 10, 2016
@marcusklaas
Copy link
Contributor

This is sort-of by design. Didn't you want to hold off the default settings discussion until after 1.0 @nrc?

@nrc
Copy link
Member

nrc commented Jun 10, 2016

How is it by design? I do want to hold off on getting the defaults exactly right, but this seems like a bug.

@nrc nrc closed this as completed Jun 10, 2016
@marcusklaas marcusklaas reopened this Jun 10, 2016
@marcusklaas
Copy link
Contributor

marcusklaas commented Jun 10, 2016

This is the exact discussion we had here, if I'm not mistaken.

@nrc
Copy link
Member

nrc commented Jun 10, 2016

Oh yes, it is! I thought this would be fixed by #1016, but apparently not?

@marcusklaas
Copy link
Contributor

This isn't question mark related. I'm glad you seem to agree now that it needs fixing though ;-)

@nrc
Copy link
Member

nrc commented Jun 10, 2016

Oh right, it is this thing. Yeah, looking at it with fresh eyes, it is pretty bad. Still don't like the alternative though.

@topecongiro
Copy link
Contributor

Closing since this is fixed on the current master.

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

No branches or pull requests

4 participants