[tor-bugs] #26972 [Core Tor/Tor]: Create CI task to ensure that all Rust files have been formatted with rustfmt

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Aug 6 10:36:53 UTC 2018


#26972: Create CI task to ensure that all Rust files have been formatted with
rustfmt
--------------------------+--------------------------------
 Reporter:  chelseakomlo  |          Owner:  teor
     Type:  enhancement   |         Status:  needs_revision
 Priority:  Medium        |      Milestone:
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  rust          |  Actual Points:
Parent ID:                |         Points:
 Reviewer:  teor          |        Sponsor:
--------------------------+--------------------------------
Changes (by teor):

 * status:  assigned => needs_revision
 * reviewer:   => teor
 * type:  task => enhancement


Comment:

 Replying to [comment:2 cypherpunks3]:
 > Can someone check out the branch 'rustfmt-travis' at
 https://gitgud.io/onionk/tor.git ?

 Thanks for this patch!

 The changes look like they should work, but we could tweak a few things to
 follow Tor's standards.

 Here are the changes I'd like to see:
 * open a separate ticket for deny(missing_docs), so we don't forget to fix
 the docs
 * make `cargo fmt --all -- --check` into `make check-rustfmt`. When tor is
 configured with Rust, and rustfmt-preview is installed, run `make check-
 rustfmt` during `make check-spaces`.
 * add a `make rustfmt` target, and tell developers about it if `make
 check-rustfmt` fails.

 (If we make these changes, we won't have to add a separate check to
 travis.)

 > But there's a bug upstream in rustfmt, which happens when it's
 configured with max_width=80 (like it is in `src/rust/.rustfmt.toml`).

 I'm not sure about the impact of the bug.
 Does it produce ugly formatting, or is the syntax incorrect?

 Do you think we should give up on max_width=80?
 We can reconsider wrapping to 80 characters when stable supports wrapping
 comments.

 If we want to match Tor's C files, we should be wrapping to 79 characters:
 https://gitweb.torproject.org/tor.git/tree/doc/HACKING/CodingStandards.md#n177

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/26972#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list