Skip to content

Commit 7c4d7ee

Browse files
authored
feat: CI check cargo-fmt-check and cargo fmt fixes (#1197)
1 parent 18e6297 commit 7c4d7ee

File tree

10 files changed

+55
-39
lines changed

10 files changed

+55
-39
lines changed

.github/workflows/checks-all.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,18 @@ jobs:
367367

368368
- name: Run MCR Client Tests
369369
run: nix develop --command bash -c "just mcr-client native build.local.test -t=false"
370+
371+
cargo-fmt-check:
372+
name: Cargo Format Check
373+
runs-on: ubuntu-latest
374+
375+
steps:
376+
- name: Checkout repository
377+
uses: actions/checkout@v4
378+
379+
- name: Run cargo fmt
380+
run: |
381+
cargo fmt --all -- --check
370382
371383
# Indexer:
372384
# strategy:

demo/hsm/src/cli/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ use clap::Parser;
44
#[derive(Parser)]
55
#[clap(rename_all = "kebab-case")]
66
pub enum HsmDemo {
7-
#[clap(subcommand)]
8-
Server(server::Server),
7+
#[clap(subcommand)]
8+
Server(server::Server),
99
}
1010

1111
impl HsmDemo {
12-
pub async fn run(&self) -> Result<(), anyhow::Error> {
13-
match self {
14-
HsmDemo::Server(server) => server.run().await,
15-
}
16-
}
12+
pub async fn run(&self) -> Result<(), anyhow::Error> {
13+
match self {
14+
HsmDemo::Server(server) => server.run().await,
15+
}
16+
}
1717
}

demo/hsm/src/cli/server/ed25519/hashi_corp_vault.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ use tokio::sync::Mutex;
1414
#[derive(Debug, Parser, Clone)]
1515
#[clap(rename_all = "kebab-case", about = "Runs signing app for ed25519 against HashiCorp Vault")]
1616
pub struct HashiCorpVault {
17-
canonical_key: String,
18-
#[arg(long)]
19-
create_key: bool,
17+
canonical_key: String,
18+
#[arg(long)]
19+
create_key: bool,
2020
}
2121

2222
impl HashiCorpVault {
23-
pub async fn run(&self) -> Result<(), anyhow::Error> {
24-
let key = Key::try_from_canonical_string(self.canonical_key.as_str())
25-
.map_err(|e| anyhow::anyhow!(e))?;
26-
let builder = Builder::<Ed25519>::new().create_key(self.create_key);
27-
let hsm = Signer::new(builder.build(key).await?);
23+
pub async fn run(&self) -> Result<(), anyhow::Error> {
24+
let key = Key::try_from_canonical_string(self.canonical_key.as_str())
25+
.map_err(|e| anyhow::anyhow!(e))?;
26+
let builder = Builder::<Ed25519>::new().create_key(self.create_key);
27+
let hsm = Signer::new(builder.build(key).await?);
2828

29-
let server_hsm = Arc::new(Mutex::new(hsm));
30-
let app_state = Arc::new(AppState::new());
29+
let server_hsm = Arc::new(Mutex::new(hsm));
30+
let app_state = Arc::new(AppState::new());
3131

32-
let app = create_server(server_hsm, app_state);
33-
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
34-
println!("Server listening on {}", addr);
32+
let app = create_server(server_hsm, app_state);
33+
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
34+
println!("Server listening on {}", addr);
3535

36-
Server::bind(&addr).serve(app.into_make_service()).await?;
36+
Server::bind(&addr).serve(app.into_make_service()).await?;
3737

38-
Ok(())
39-
}
38+
Ok(())
39+
}
4040
}

demo/hsm/src/cli/server/secp256k1/aws_kms.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ pub struct AwsKms {
2121
}
2222

2323
impl AwsKms {
24-
pub async fn run(&self) -> Result<(), anyhow::Error> {
25-
let key = Key::try_from_canonical_string(self.canonical_key.as_str())
26-
.map_err(|e| anyhow::anyhow!(e))?;
27-
let builder = Builder::<Secp256k1>::new().create_key(self.create_key);
28-
let hsm = Signer::new(builder.build(key).await?);
24+
pub async fn run(&self) -> Result<(), anyhow::Error> {
25+
let key = Key::try_from_canonical_string(self.canonical_key.as_str())
26+
.map_err(|e| anyhow::anyhow!(e))?;
27+
let builder = Builder::<Secp256k1>::new().create_key(self.create_key);
28+
let hsm = Signer::new(builder.build(key).await?);
2929

30-
let server_hsm = Arc::new(Mutex::new(hsm));
31-
let app_state = Arc::new(AppState::new());
30+
let server_hsm = Arc::new(Mutex::new(hsm));
31+
let app_state = Arc::new(AppState::new());
3232

33-
let app = create_server(server_hsm, app_state);
33+
let app = create_server(server_hsm, app_state);
3434

35-
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
36-
println!("Server listening on {}", addr);
35+
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
36+
println!("Server listening on {}", addr);
3737

38-
Server::bind(&addr).serve(app.into_make_service()).await?;
38+
Server::bind(&addr).serve(app.into_make_service()).await?;
3939

40-
Ok(())
41-
}
40+
Ok(())
41+
}
4242
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

networks/movement/movement-client/src/bin/e2e/simple_interaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use anyhow::Context;
2-
use once_cell::sync::Lazy;
3-
use std::str::FromStr;
42
use movement_client::{
53
coin_client::CoinClient,
64
rest_client::{Client, FaucetClient},
75
types::LocalAccount,
86
};
7+
use once_cell::sync::Lazy;
8+
use std::str::FromStr;
99
use url::Url;
1010

1111
static SUZUKA_CONFIG: Lazy<movement_config::Config> = Lazy::new(|| {

networks/movement/movement-full-node/src/backup/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,4 @@ fn get_root_path(initial_dir: Option<&String>) -> Result<PathBuf, anyhow::Error>
261261
Ok(dot_movement.get_path().to_path_buf())
262262
}
263263
}
264-
}
264+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)