Skip to content
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

Enforce Rust code format on CI #213

Merged
merged 2 commits into from
Apr 5, 2024
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: 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
Loading