torproject / tor Public
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
#26972: Create CI task to ensure that all Rust files have been formatted with rustfmt #265
Conversation
Please see my comments on the pull request. We just need a few minor tweaks, then we'll be ready to merge.
Makefile.am
Outdated
| rustfmt: | ||
| if USE_RUST | ||
| @if test -x "`which cargo-fmt 2>&1;true`"; then \ | ||
| (cd "$(top_srcdir)/src/rust" && cargo fmt --all --); \ |
This comment has been hidden.
This comment has been hidden.
Sorry, something went wrong.
| else \ | ||
| echo "Tor uses rustfmt (via cargo-fmt) to format Rust code."; \ | ||
| echo "However, it seems that you don't have rustfmt installed."; \ | ||
| printf "You can install rustfmt by following the directions here:"; \ |
This comment has been hidden.
This comment has been hidden.
Sorry, something went wrong.
Makefile.am
Outdated
| else \ | ||
| echo "Tor uses rustfmt (via cargo-fmt) to format Rust code."; \ | ||
| echo "However, it seems that you don't have rustfmt installed."; \ | ||
| printf "You can install rustfmt by following the directions here:"; \ |
This comment has been hidden.
This comment has been hidden.
Sorry, something went wrong.
Makefile.am
Outdated
| @if test -x "`which cargo-fmt 2>&1;true`"; then \ | ||
| (cd "$(top_srcdir)/src/rust" && cargo fmt --all -- --check) || \ | ||
| (echo "**************** check-rustfmt failed. ****************"; \ | ||
| echo " Run \`make rustfmt\` to apply the above changes."); \ |
make should fail if check-rustfmt fails, like all the other check targets
src/rust/.rustfmt.toml
Outdated
| @@ -1,2 +1,12 @@ | |||
| max_width = 80 | |||
Please use the default Rust max_width, see https://trac.torproject.org/projects/tor/ticket/27071
| @@ -10,14 +10,12 @@ | |||
| use std::collections::HashMap; | |||
| use std::env; | |||
| use std::fs::File; | |||
| use std::io::prelude::*; | |||
This comment has been hidden.
This comment has been hidden.
Sorry, something went wrong.
src/rust/protover/protover.rs
Outdated
| @@ -624,7 +624,7 @@ impl ProtoverVote { | |||
| } | |||
|
|
|||
| for (protocol, versions) in vote.iter() { | |||
| let supported_vers: &mut HashMap<Version, usize> = | |||
| let supported_vers: &mut HashMap<_, usize> = | |||
If we're using the default max_width, we might not need this change.
Makefile.am
Outdated
| check-rustfmt: | ||
| if USE_RUST | ||
| @if test -x "`which cargo-fmt 2>&1;true`"; then \ | ||
| (cd "$(top_srcdir)/src/rust" && cargo fmt --all -- --check) || \ |
Before running rustfmt --check, please echo a message saying what rustfmt --check does.
For example, check-typos says:
echo "Checking for Typos ..."; \
These are the 12 stable and documented configuration options, set to their default values. use_small_heuristics is only stabilized in rustfmt 0.9, so maintain support for 0.8.x for now by commenting it out. comment_width is unstable and did nothing, since wrap_comments defaults to false. Default values gotten from `rustfmt --print-config default rustfmt.toml`. https://github.com/rust-lang-nursery/rustfmt/blob/e7932fa9c2591c45a37a24305de90cb63128afcf/Configurations.md
|
Obsoleted by #275. |
No description provided.
The text was updated successfully, but these errors were encountered: