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 #1118

Merged
merged 1 commit into from
Dec 23, 2019
Merged

Run rustfmt #1118

merged 1 commit into from
Dec 23, 2019

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 21, 2019

This is cargo +nightly fmt --all with rustc 1.41.0-nightly (c8ea4ace9 2019-12-14)

@RalfJung
Copy link
Member

This basically confirms what I thought about rustfmt: that a large fraction of the things it changes are somewhat questionable, and a smaller fraction outright makes things worse and needs manual clean-up. :/

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 21, 2019

a large fraction of the things it changes are somewhat questionable

But automatable :D I'm fine with a few things being odd

and a smaller fraction outright makes things worse

I think most of these I have been able to fix with the rustfmt.toml flag

and needs manual clean-up.

Well, the situations I have manually fixed weren't ideal to begin with. I think some of them are now significantly better

| "acos"
| "asin"
| "atan"
=> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

opinions on this style? I like it because it makes changing the list never cause fallout in unrelated elements

Copy link
Member

@RalfJung RalfJung Dec 21, 2019

Choose a reason for hiding this comment

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

Not all lines are consistent though, the first line is different. So the thing that would be most like how we format comma-separated lists would be to make every line "foo" |. Unfortunately though, this does not compile.

So the version taht compiles would be to make every line | "foo", I guess? Including the first line, like this.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like that's what you got. So in the confines of the Rust grammar, I guess that is the best we'll get.

Shame that rustfmt destroys that. :/

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 22, 2019

Do you want to wait on merging this until the second rustfmt issue is solved or are the rustfmt::skips ok for now?

@RalfJung
Copy link
Member

No, we don't have to wait for that.

But we should probably land #1101 first due to conflicts.

@RalfJung
Copy link
Member

Also it would probably be best to exclude env.rs to avoid conflicts with #1098.

@bors
Copy link
Contributor

bors commented Dec 22, 2019

☔ The latest upstream changes (presumably #1101) made this pull request unmergeable. Please resolve the merge conflicts.

_ => {
throw_unsup_format!("The {} error cannot be transformed into a raw os error", e)
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could set match_arm_blocks = false to avoid things like this?

Copy link
Member

Choose a reason for hiding this comment

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

Interestingly this still gets a block, even with match_arm_blocks = false? Any idea why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe rustfmt bailed out further up in the ast here out of other reasons?

@RalfJung
Copy link
Member

rustc's rustfmt.toml also has version = "Two". Should we use that, too? Not sure what difference it makes.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2019

no clue about version = "Two", let's see what happens

@oli-obk oli-obk force-pushed the stacked_borrow_tracing branch from 0c066fb to 734fa6c Compare December 23, 2019 11:15
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2019

version = "Two" and match_arm_blocks = false have superb effects on the code.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2019

I'll squash and exclude env.rs changes after you're alright with the two new commits

@RalfJung
Copy link
Member

Works for me. I'd still format some bits differently but those are nits.

@oli-obk oli-obk force-pushed the stacked_borrow_tracing branch from 734fa6c to 7ead530 Compare December 23, 2019 11:56
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Dec 23, 2019

📌 Commit 7ead530 has been approved by oli-obk

@bors
Copy link
Contributor

bors commented Dec 23, 2019

⌛ Testing commit 7ead530 with merge 20e843f...

bors added a commit that referenced this pull request Dec 23, 2019
Run rustfmt

This is `cargo +nightly fmt --all` with `rustc 1.41.0-nightly (c8ea4ace9 2019-12-14)`
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2019

next step, block CI on rustfmt?

@RalfJung
Copy link
Member

I feared you'd suggest this. :/ But that seems to be the way the Rust community is moving, even though I am not terribly happy about it TBH. I don't consider rustfmt "better" unambiguously enough.

Maybe let's wait a bit how enforcing rustfmt works out for rustc itself?

@bors
Copy link
Contributor

bors commented Dec 23, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 20e843f to master...

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2019

I feared you'd suggest this. :/ But that seems to be the way the Rust community is moving, even though I am not terribly happy about it TBH. I don't consider rustfmt "better" unambiguously enough.

I don't consider rustfmt better either. But it's just so convenient when I can turn it on on a project. I stop doing any kind of formatting myself. I press save or move the window focus and the file is formatted.

Maybe let's wait a bit how enforcing rustfmt works out for rustc itself?

Fine by me. We can also leave it off for this repo since you dislike enforcing rustfmt on CI. It just means that sometimes we'll start getting unrelated changes if someone with rustfmt turned on edits something that was previously edited by someone who doesn't use rustfmt.

An intermediate state would be to add CI trickery to automatically add a rustfmt commit before running bors

@oli-obk oli-obk deleted the stacked_borrow_tracing branch December 23, 2019 13:39
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.

3 participants