Skip to content

Commit

Permalink
Merge pull request p2pderivatives#213 from p2pderivatives/rustfmt-on-ci
Browse files Browse the repository at this point in the history
Enforce Rust code format on CI
  • Loading branch information
Tibo-lg authored Apr 5, 2024
2 parents cf94bf5 + 883ad23 commit af15d5b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ jobs:
run: rustup component add clippy
- name: Run clippy
run: cargo clippy -- -D warnings
fmt:
name: rustfmt-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check format
run: cargo fmt --all --check
no-std:
name: no-std lint
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion dlc-manager/src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl std::fmt::Debug for Channel {
Channel::Signed(_) => "signed",
Channel::FailedAccept(_) => "failed accept",
Channel::FailedSign(_) => "failed sign",
Channel::Cancelled(_) => "cancelled"
Channel::Cancelled(_) => "cancelled",
};
f.debug_struct("Contract").field("state", &state).finish()
}
Expand Down
10 changes: 6 additions & 4 deletions dlc-manager/tests/channel_execution_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,13 @@ fn channel_execution_test(test_params: TestParams, path: TestPath) {
assert_channel_state!(alice_manager_send, temporary_channel_id, Offered);

if let TestPath::CancelOffer = path {
let (reject_msg, _) = alice_manager_send.lock().unwrap().reject_channel(&temporary_channel_id).expect("Error rejecting contract offer");
let (reject_msg, _) = alice_manager_send
.lock()
.unwrap()
.reject_channel(&temporary_channel_id)
.expect("Error rejecting contract offer");
assert_channel_state!(alice_manager_send, temporary_channel_id, Cancelled);
alice_send
.send(Some(Message::Reject(reject_msg)))
.unwrap();
alice_send.send(Some(Message::Reject(reject_msg))).unwrap();

sync_receive.recv().expect("Error synchronizing");
assert_channel_state!(bob_manager_send, temporary_channel_id, Cancelled);
Expand Down
2 changes: 2 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
edition = "2021"
max_width = 100

0 comments on commit af15d5b

Please sign in to comment.