-
Notifications
You must be signed in to change notification settings - Fork 4
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
Better rustfmt #51
Better rustfmt #51
Conversation
Codecov Report
@@ Coverage Diff @@
## master #51 +/- ##
==========================================
- Coverage 76.12% 75.77% -0.35%
==========================================
Files 22 21 -1
Lines 5340 5288 -52
==========================================
- Hits 4065 4007 -58
- Misses 1275 1281 +6
Continue to review full report at Codecov.
|
Can you please precisely list what changes you made exactly? I also find it easier to look at horizontal lists to grab an overview that's why I chose |
9780ecc
to
b4ed7ab
Compare
I decided to go with your
|
My comments on your proposals below.
I will think about this.
Maybe we want this for CI instead since I do not want to pollute too many warnings into errors as I have made the experience of this causing troubles with prototyping new code.
My experience in the past with these flags were very positive. But also maybe we want to provide those as errors in CI. I'll think about it.
If this really fixes problem I wonder why it isn't the default. Can you elaborate or link to an issue?
I like this but it is unstable (as some other already used flags) and since
I have had bad experience with these in the past and won't accept them therefore. |
b4ed7ab
to
08bb1fd
Compare
I am using
I only found about five places in the entire codebase that rustfmt was unable to format, mainly due to comments in the middle of method chains.
These should be put in CI.
I have experienced only positive things, except for the documentation for |
Github has a feature to view all non-whitespace changes |
08bb1fd
to
4a31e0a
Compare
I fixed the merge conflicts. The |
There are warnings after the rebase that appear to be from your commits. I will fix them sometime next week. |
Are you still not satisfied with my changes? |
Have to give it another look.
... more readable than ...
|
Should I squash the last three commits? |
wait, I just realized I need to rebase on top of the |
8d810c1
to
4320db5
Compare
That should be it, except I am getting the warning
I presume this is from the commit that supports no_std |
Then maybe we simply need a cfg |
I fixed the warning for most cases and a compilation error for serde_support with no_std. For some bizarre reason, when I run with |
I am almost done with getting my division algorithms into compiler-builtins. When are you going to merge this? |
Sorry, forgot about this PR. |
rust-lang/compiler-builtins#332 This will greatly improve u128 division and divisions for 32 bit platforms |
All I want for Christmas is a rapid PR review cycle |
force_multiline_blocks = true # help certain closures | ||
format_code_in_doc_comments = true # changed | ||
format_macro_bodies = true # changed | ||
format_macro_matchers = true # changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused problems in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have unchanged them all.
format_code_in_doc_comments = true # changed | ||
format_macro_bodies = true # changed | ||
format_macro_matchers = true # changed | ||
format_strings = true # changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not a good default to have. Why would you want that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had any bad experiences with those settings, except for changing the force_multiline_blocks = true
setting which was actually better with its default value. I can't remember my reasoning from a few months ago.
imports_layout = "Vertical" # changed | ||
imports_layout = "Vertical" # makes editing quicker | ||
indent_style = "Block" | ||
inline_attribute_width = 0 # unchanged, for ease of editing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is unstable and since we only set it to its default pls remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
.rustfmt.toml
Outdated
report_fixme = "Never" | ||
report_todo = "Never" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should actually report them always. At least I would want that because I would not like to merge any PRs that actually have those in them. Instead convert TODO and FIXME into proper issues with proper description before merging a PR. This is a really nice to have warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
error_on_line_overflow = true # be more strict | ||
error_on_unformatted = true # be more strict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error if Rustfmt is unable to get all lines within max_width, except for comments and string literals. If this happens, then it is a bug in Rustfmt.
Reeeeeally not sure if I want our CI to fail because of a bug in rustfmt ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a bug I encountered (rust-lang/rustfmt#3805), but it was easily fixable by changing the signature width.
You can help this rapid PR review cycle by chunking your commits in a way that makes them easy to review. For example in this PR the single most important file is obviously |
What happened here was I completely replaced the existing rustfmt.toml with my original rustfmt.toml I had made for the reorganization PR that never made it. I should have put yours in alphabetical order in one commit, and then replaced it with another commit. |
I had a really bad sickness recently and it sapped all my energy and is distorting my judgement. I will redo the commits a third time to fix your problems |
9e245dd
to
494faba
Compare
I split up the formatting itself to show you what the
part does so you can see it is useful |
|
It is fine. I have already went through the whole changes. I will give it another look tomorrow (very tired rn) and probably approve and merge then. Thank you again for all your work on this crate! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perfect now and due to the new commit history super easy to review! Thank you!
I compared the
.rustfmt.toml
I made with yours and I am suggesting a few changes. I placed the keys in alphabetical order. I think usingimports_layout = "HorizontalVertical"
is better since it uses horizontal layout for 2-4 imports (typically) and a vertical layout for longer than that.I think keeping comment width at 80 is a good idea, however I would prefer the default
max_width = 100
. I also used a few nightly keys to improve comment formatting.