Skip to content

Ensure formatted code on automation. #1621

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

Merged
merged 2 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ mod target {
pub fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());

let mut dst = File::create(Path::new(&out_dir).join("host-target.txt"))
.unwrap();
let mut dst =
File::create(Path::new(&out_dir).join("host-target.txt")).unwrap();
dst.write_all(env::var("TARGET").unwrap().as_bytes())
.unwrap();
}
Expand All @@ -24,8 +24,8 @@ mod testgen {

pub fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let mut dst = File::create(Path::new(&out_dir).join("tests.rs"))
.unwrap();
let mut dst =
File::create(Path::new(&out_dir).join("tests.rs")).unwrap();

let manifest_dir =
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
Expand Down Expand Up @@ -57,7 +57,8 @@ mod testgen {
"test_header!(header_{}, {:?});",
func,
entry.path(),
).unwrap();
)
.unwrap();
}
_ => {}
}
Expand Down
10 changes: 3 additions & 7 deletions ci/assert-rustfmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
set -xeu
cd "$(dirname "$0")/.."

# Ensure we have the most up-to-date `rustfmt`.
cargo install -f rustfmt
rustup update nightly
rustup component add rustfmt --toolchain nightly

# Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it
# prints an error and exits non-zero, so tell it to kindly shut its yapper and
# make sure it doesn't cause us to exit this whole script non-zero.
cargo fmt --quiet || true

# Exit non-zero if this resulted in any diffs.
./ci/assert-no-diff.sh

rustup run nightly cargo fmt -- --check
3 changes: 1 addition & 2 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ case "$BINDGEN_JOB" in
./ci/assert-docs.sh
./ci/test-book.sh
./ci/no-includes.sh
# `rustfmt` isn't reaching a fixed point on bindgen
# code... https://github.com/rust-lang/rustfmt/issues/1376
# Disabled because https://github.com/rust-lang/rustfmt/issues/3799.
# ./ci/assert-rustfmt.sh
;;

Expand Down
5 changes: 1 addition & 4 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
max_width = 80
brace_style = "SameLineWhere"
struct_lit_single_line = false
where_trailing_comma = true
normalize_comments = false
binop_separator = "back"
3 changes: 1 addition & 2 deletions src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe {

/// This will be run on every string macro. The callback can not influence the further
/// treatment of the macro, but may use the value to generate additional code or configuration.
fn str_macro(&self, _name: &str, _value: &[u8]) {
}
fn str_macro(&self, _name: &str, _value: &[u8]) {}

/// This function should return whether, given an enum variant
/// name, and value, this enum variant will forcibly be a constant.
Expand Down
Loading