Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFormat our code with rustfmt #8553
Comments
|
cc: @Manishearth ? |
|
Ms2ger and I have filed a lot of issues each time we've tried rustfmt on Servo. We could certainly start running it on particular files that don't end up with terrible output. |
|
It's not ready yet. I periodically try running it on Servo. |
|
Anyone know how Go projects incorporate gofmt (or Rust w/ rustfmt) into project workflows? Require that it get used pre-commit and checked via CI? Have the build system automatically format upon check-in (which sounds scary)? Something else? |
|
I think it would be better to check in CI the commited files as tidy which we're running. It's not enough? |
|
Checked via CI I think. Similar to how clippy checks update_lints or how servo checks lockfile_changed. I'd rather not gate CI on rustfmt though. I'm slightly more okay with it if we use circleci or something for tidy+fmt to get separate and immediate status icons from the long build. |
|
So I've been poking around, and rustfmt seems to be much more stable now. The following toml config is pretty nice for servo reorder_imports = true
reorder_imported_names = true
max_width = 120
ideal_width = 80
normalize_comments = false
rustfmt currently doesn't reorder I would like to reformat everything and slowly make rustfmt part of CI checks. Perhaps removing the corresponding tidy checks. Thoughts? @jdm @Ms2ger @wafflespeanut |
|
I'm open to that plan. I think adding extern crate reordering to rustfmt makes the most sense. |
|
It'd be wonderful to have rustfmt in tree. Also, tidy's sorting isn't that great right now (#9259). We can improve it in tidy, but rustfmt should do this better. I never imagined that rustfmt could be integrated so easily |
Rustfmt script_traits and net_traits. CC #8553. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14831) <!-- Reviewable:end -->
Format parts of layout Formats the following files: * components/layout/display_list_builder.rs * components/layout/webrender_helpers.rs Remove outdated options from rustfmt.toml. Configure rustfmt to place binary operators at the end of line (to match ./mach test-tidy). Rationale: I am tired of indenting my patches by hand trying my best to do it correctly and match the surrounding code. Just to be told that either my indentation is wrong or that I should switch to block indentation for this function because it looks better. The new formatting passes `./mach test-tidy`. Compared to the old formatting it is a lot more consistent but also tends to spread the code across more lines. The diff is this big because a lot of code used visual indentation. See also #8553 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19681) <!-- Reviewable:end -->
It can be installed with The formatting works with |
|
Is this done now? |
|
Done by #22126 ! |
I think we should do this.