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

run rustfmt on libsyntax_ext folder #35614

Merged
merged 1 commit into from
Aug 17, 2016
Merged

run rustfmt on libsyntax_ext folder #35614

merged 1 commit into from
Aug 17, 2016

Conversation

srinivasreddy
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

prec),
self.ecx.field_imm(sp,
self.ecx.ident_of("width"),
width)]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is horrifying.

Copy link
Contributor Author

@srinivasreddy srinivasreddy Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the first impression i got too. Let's see what @nrc says .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of edge-casey because the better formatting requires breaking after the ( which is usually avoided. You could add a skip annotation to the statement, or just ignore it - I'm willing to eat the occasional poor formatting in exchange for automated formatting everywhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make a rule where for every broken ( the appropriate ending ) is also broken?
That way it would look visually consistent; would solve this edge case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not really the problem. The problem is that we have no heuristics for when to break after the ( in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we switch to a style that doesn't have these kinds of awful edge cases? These continue to pop up. We have an alternative (finally), based on winapi:

https://ubsan.github.io/style/

Copy link
Contributor

@jseyfried jseyfried Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ubsan Wow, thanks for writing that up -- I really like that style!

#34584 (comment) summarizes @petrochenkov's and my thoughts on these PRs. I really dislike rustfmt's non-block indenting ("visual indenting") that makes this example so horrifying (and also appears to be the main cause of the problems you referenced in the "Why we need this" section).

Copy link
Member

@eddyb eddyb Aug 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style I prefer is this:

                    self.ecx.expr_struct(sp, path, vec![
                        self.ecx.field_imm(sp, self.ecx.ident_of("fill"), fill),
                        self.ecx.field_imm(sp, self.ecx.ident_of("align"), align),
                        self.ecx.field_imm(sp, self.ecx.ident_of("flags"), flags),
                        self.ecx.field_imm(sp, self.ecx.ident_of("precision"), prec),
                        self.ecx.field_imm(sp, self.ecx.ident_of("width"), width)
                    ]);

EDIT: Apparently this is "block indenting" which is part of @ubsan's style guide.

Copy link
Contributor

@strega-nil strega-nil Aug 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's block style :)

last argument is multi-line

(note that I just added this; I used to only do that for multi-line single-argument functions, but I realized that this was a failure I needed to address, so I made sure it was all functions which ended with a multi-line argument).

@nikomatsakis
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 16, 2016

📌 Commit d652639 has been approved by nikomatsakis

@nikomatsakis
Copy link
Contributor

I'm willing to eat the occasional poor formatting in exchange for automated formatting everywhere.

This is also my POV, though if someone wants to file an issue on rustfmt, that seems fine. (I don't think this PR is the place to debate what rustfmt's heuristics unless there is a genuine bug.)

@strega-nil
Copy link
Contributor

@nikomatsakis the issue was, until about 3 hours ago, we did not have a team to debate this :P

vec![self_ty],
lifetimes,
self_params,
Vec::new())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function call can remain on one line -- not sure why rustfmt breaks it up...

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 17, 2016
…=nikomatsakis

run rustfmt on libsyntax_ext folder
bors added a commit that referenced this pull request Aug 17, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 17, 2016
…=nikomatsakis

run rustfmt on libsyntax_ext folder
bors added a commit that referenced this pull request Aug 17, 2016
@bors bors merged commit d652639 into rust-lang:master Aug 17, 2016
@srinivasreddy srinivasreddy deleted the syntax_ext_rustfmt branch August 18, 2016 14:38
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

Successfully merging this pull request may close these issues.

10 participants