diff --git a/README.md b/README.md index 81984cd..e02e59d 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,12 @@ To analyze the firmware's code size, you need [cargo-bloat](https://github.com/R - `make bloat` - `make bloat BLOAT_ARGS="--crates" # passing arguments to cargo-bloat` -Our CI requires consistent formatting, please run rustfmt before you submit PRs: +Our CI requires consistent formatting, please use our pre-commit hook +to make sure: + +- `cp scripts/pre-commit .git/hooks/pre-commit` + +To fix formatting: - `make fmt` diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100755 index 0000000..834b68a --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +cargo fmt --all -- --check diff --git a/src/bluetooth.rs b/src/bluetooth.rs index 8fb9fbe..5aa0a4f 100644 --- a/src/bluetooth.rs +++ b/src/bluetooth.rs @@ -153,7 +153,8 @@ where .log_error(); } _ => { - crate::heprintln!("msg: System {} {:?}", message.operation, message.data).ok(); + crate::heprintln!("msg: System {} {:?}", message.operation, message.data) + .ok(); } } } @@ -230,7 +231,8 @@ where crate::heprintln!("TODO: Keyboard Sync").ok(); } _ => { - crate::heprintln!("msg: Keyboard {} {:?}", message.operation, message.data).ok(); + crate::heprintln!("msg: Keyboard {} {:?}", message.operation, message.data) + .ok(); } }, MsgType::Macro => match MacroOp::from(message.operation) { @@ -244,7 +246,9 @@ where _ => { crate::heprintln!( "msg: {:?} {} {:?}", - message.msg_type, message.operation, message.data + message.msg_type, + message.operation, + message.data ) .ok(); } diff --git a/src/led.rs b/src/led.rs index f2016d7..1bcf0b5 100644 --- a/src/led.rs +++ b/src/led.rs @@ -222,7 +222,9 @@ where _ => { crate::heprintln!( "lmsg: {:?} {} {:?}", - message.msg_type, message.operation, message.data + message.msg_type, + message.operation, + message.data ) .ok(); } @@ -231,7 +233,9 @@ where _ => { crate::heprintln!( "lmsg: {:?} {} {:?}", - message.msg_type, message.operation, message.data + message.msg_type, + message.operation, + message.data ) .ok(); }