Skip to content

Commit 6f8a988

Browse files
committed
Format code and document running cargo fmt
1 parent 9a2aa96 commit 6f8a988

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ cargo clippy --all-targets -- -D warnings
4747

4848
When the user asks to run clippy and provides the ability to run on both targets, try to run it
4949
on both targets.
50+
51+
## Formatting
52+
53+
After modifying code, run `cargo fmt` to ensure consistent formatting before committing changes.

build.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::process::Command;
21
use std::env;
2+
use std::process::Command;
33

44
fn main() {
55
// Retrieve crate version provided by Cargo
@@ -10,14 +10,19 @@ fn main() {
1010
.args(["rev-parse", "--short", "HEAD"])
1111
.output()
1212
.ok()
13-
.and_then(|o| if o.status.success() {
14-
Some(String::from_utf8_lossy(&o.stdout).trim().to_string())
15-
} else {
16-
None
13+
.and_then(|o| {
14+
if o.status.success() {
15+
Some(String::from_utf8_lossy(&o.stdout).trim().to_string())
16+
} else {
17+
None
18+
}
1719
})
1820
.unwrap_or_else(|| "unknown".to_string());
1921

2022
// Export as environment variables for use in the code and tests
2123
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
22-
println!("cargo:rustc-env=VERSION_WITH_GIT_HASH={} ({})", version, git_hash);
24+
println!(
25+
"cargo:rustc-env=VERSION_WITH_GIT_HASH={} ({})",
26+
version, git_hash
27+
);
2328
}

tests/smoke_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ fn test_httpjail_version() {
1616
let mut cmd = Command::cargo_bin("httpjail").unwrap();
1717
cmd.arg("--version");
1818
let hash = env!("GIT_HASH");
19-
cmd.assert().success().stdout(
20-
predicate::str::contains("httpjail").and(predicate::str::contains(hash)),
21-
);
19+
cmd.assert()
20+
.success()
21+
.stdout(predicate::str::contains("httpjail").and(predicate::str::contains(hash)));
2222
}
2323

2424
#[test]

0 commit comments

Comments
 (0)