Skip to content

Commit 5ab42ab

Browse files
Merge pull request #320 from Concordium/cor-1763
Update Rust formatter
2 parents 2ecf03d + 9b17dbd commit 5ab42ab

File tree

76 files changed

+1609
-1380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1609
-1380
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ on:
1414

1515
workflow_dispatch: # allows manual trigger
1616

17-
env:
18-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
19-
2017
jobs:
2118
"lint_fmt":
2219
name: lint:fmt
@@ -26,8 +23,8 @@ jobs:
2623
uses: actions/checkout@v4
2724
- name: Format
2825
run: |
29-
rustup +$RUST_FMT component add rustfmt
30-
cargo +$RUST_FMT fmt -- --color=always --check
26+
rustup component add rustfmt
27+
cargo fmt -- --color=always --check
3128
3229
"lint_doc":
3330
name: lint:doc

examples/balance-summary.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ struct App {
2121
long = "lastfinal",
2222
help = "Block to query the data in. Defaults to last finalized block."
2323
)]
24-
block: BlockIdentifier,
24+
block: BlockIdentifier,
2525
#[structopt(
2626
long = "num",
2727
help = "How many queries to make in parallel.",
2828
default_value = "1"
2929
)]
30-
num: usize,
30+
num: usize,
3131
}
3232

3333
async fn make_queries<
@@ -43,7 +43,8 @@ async fn make_queries<
4343
) -> (tokio::task::JoinHandle<()>, tokio::sync::mpsc::Receiver<A>)
4444
where
4545
Chunks::IntoIter: Send,
46-
I::IntoIter: Send, {
46+
I::IntoIter: Send,
47+
{
4748
let (sender, receiver) = tokio::sync::mpsc::channel::<A>(n);
4849
let sender = async move {
4950
'outer: for chunk in iter {

examples/block-stats.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ struct App {
3131
long = "from",
3232
help = "Starting time (format 2023-06-22T14:00:00+0200). Defaults to genesis time."
3333
)]
34-
from: Option<chrono::DateTime<chrono::Utc>>,
34+
from: Option<chrono::DateTime<chrono::Utc>>,
3535
#[structopt(
3636
long = "to",
3737
help = "End time (format 2023-06-22T14:00:00+0200). Defaults to the time the tool has run."
3838
)]
39-
to: Option<chrono::DateTime<Utc>>,
39+
to: Option<chrono::DateTime<Utc>>,
4040
}
4141

4242
#[tokio::main(flavor = "multi_thread")]

examples/create-initial-accounts.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ struct App {
4242
)]
4343
endpoint: Endpoint,
4444
#[structopt(long = "identity-provider")]
45-
idp: PathBuf,
45+
idp: PathBuf,
4646
#[structopt(long = "tps")]
47-
tps: u16,
47+
tps: u16,
4848
}
4949

5050
#[tokio::main(flavor = "multi_thread")]
@@ -87,7 +87,7 @@ async fn main() -> anyhow::Result<()> {
8787
let created_at = YearMonth::now();
8888
let alist = AttributeList {
8989
valid_to: YearMonth {
90-
year: created_at.year + 1,
90+
year: created_at.year + 1,
9191
month: created_at.month,
9292
},
9393
created_at,
@@ -108,7 +108,7 @@ async fn main() -> anyhow::Result<()> {
108108
let data = {
109109
let mut csprng = thread_rng();
110110
let cdata = CredentialData {
111-
keys: vec![(
111+
keys: vec![(
112112
KeyIndex::from(0),
113113
common::types::KeyPair::generate(&mut csprng),
114114
)]
@@ -130,9 +130,9 @@ async fn main() -> anyhow::Result<()> {
130130

131131
let pub_info_for_ip = PublicInformationForIp {
132132
id_cred_pub: ArCurve::generate(&mut csprng),
133-
reg_id: cred_id,
134-
vk_acc: CredentialPublicKeys {
135-
keys: cdata.get_public_keys(),
133+
reg_id: cred_id,
134+
vk_acc: CredentialPublicKeys {
135+
keys: cdata.get_public_keys(),
136136
threshold: cdata.get_threshold(),
137137
},
138138
};
@@ -148,7 +148,7 @@ async fn main() -> anyhow::Result<()> {
148148
let keys = AccountKeys::from(cdata);
149149
let item = BlockItem::<Payload>::from(AccountCredentialMessage {
150150
message_expiry: expiry,
151-
credential: AccountCredential::Initial { icdi },
151+
credential: AccountCredential::Initial { icdi },
152152
});
153153
(address, item, keys, cred_id_exponent)
154154
};

examples/find-account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct App {
1414
)]
1515
endpoint: v2::Endpoint,
1616
#[structopt(long = "account")]
17-
account: AccountAddress,
17+
account: AccountAddress,
1818
}
1919

2020
#[tokio::main(flavor = "multi_thread")]

examples/init-update-contract.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ struct App {
2626
help = "GRPC interface of the node.",
2727
default_value = "http://localhost:20000"
2828
)]
29-
endpoint: endpoints::Endpoint,
29+
endpoint: endpoints::Endpoint,
3030
#[structopt(long = "account", help = "Path to the account key file.")]
3131
keys_path: PathBuf,
3232
#[structopt(subcommand, help = "The action you want to perform.")]
33-
action: Action,
33+
action: Action,
3434
}
3535

3636
#[derive(StructOpt)]
3737
enum Action {
3838
#[structopt(about = "Initialize the contract with the provided weather")]
3939
Init {
4040
#[structopt(long, help = "The initial weather.")]
41-
weather: Weather,
41+
weather: Weather,
4242
#[structopt(
4343
long,
4444
help = "The module reference used for initializing the contract instance."

examples/list-account-balances.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ struct App {
2626
long = "lastfinal",
2727
help = "Block to query the data in. Defaults to last finalized block."
2828
)]
29-
block: BlockIdentifier,
29+
block: BlockIdentifier,
3030
#[structopt(
3131
long = "out",
3232
help = "File to output the list of accounts with their balances to."
3333
)]
34-
out: PathBuf,
34+
out: PathBuf,
3535
#[structopt(
3636
long = "num",
3737
help = "How many queries to make in parallel.",
3838
default_value = "8"
3939
)]
40-
num: usize,
40+
num: usize,
4141
}
4242

4343
#[derive(SerdeSerialize)]
4444
struct Row {
4545
#[serde(rename = "Account address")]
46-
address: AccountAddress,
46+
address: AccountAddress,
4747
#[serde(rename = "Account balance in CCD", serialize_with = "to_string")]
48-
balance: Amount,
48+
balance: Amount,
4949
#[serde(rename = "isBaker")]
5050
is_baker: bool,
5151
#[serde(rename = "Account type")]

examples/list-account-creations.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ struct App {
2020
help = "Number of parallel queries to make.",
2121
default_value = "4"
2222
)]
23-
num: usize,
23+
num: usize,
2424
#[structopt(long = "from", help = "Starting time. Defaults to genesis time.")]
25-
from: Option<chrono::DateTime<chrono::Utc>>,
25+
from: Option<chrono::DateTime<chrono::Utc>>,
2626
#[structopt(long = "to", help = "End time. Defaults to infinity.")]
27-
to: Option<chrono::DateTime<chrono::Utc>>,
27+
to: Option<chrono::DateTime<chrono::Utc>>,
2828
}
2929

3030
#[tokio::main(flavor = "multi_thread")]

examples/list-all-transactions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ struct App {
2626
help = "How many queries to make in parallel.",
2727
default_value = "1"
2828
)]
29-
num: usize,
29+
num: usize,
3030
#[structopt(long = "from", help = "Starting time. Defaults to genesis time.")]
31-
from: Option<chrono::DateTime<chrono::Utc>>,
31+
from: Option<chrono::DateTime<chrono::Utc>>,
3232
#[structopt(long = "to", help = "End time. Defaults to infinity.")]
33-
to: Option<chrono::DateTime<Utc>>,
33+
to: Option<chrono::DateTime<Utc>>,
3434
#[structopt(
3535
long = "only",
3636
help = "Only display the given transaction type(s). If no specific types are given all \
3737
types are displayed."
3838
)]
39-
types: Vec<String>,
39+
types: Vec<String>,
4040
}
4141

4242
#[tokio::main(flavor = "multi_thread")]

0 commit comments

Comments
 (0)