File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,3 +47,7 @@ cargo clippy --all-targets -- -D warnings
4747
4848When the user asks to run clippy and provides the ability to run on both targets, try to run it
4949on both targets.
50+
51+ ## Formatting
52+
53+ After modifying code, run ` cargo fmt ` to ensure consistent formatting before committing changes.
Original file line number Diff line number Diff line change 1- use std:: process:: Command ;
21use std:: env;
2+ use std:: process:: Command ;
33
44fn 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}
Original file line number Diff line number Diff 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]
You can’t perform that action at this time.
0 commit comments