Skip to content

Commit 352c1a0

Browse files
Merge pull request #485 from Concordium/cor-1763
Update Rust formatter
2 parents adf64fe + 2393b96 commit 352c1a0

File tree

10 files changed

+49
-70
lines changed

10 files changed

+49
-70
lines changed

.github/workflows/deploy-ccd-js-gen.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ concurrency:
2323
env:
2424
NODE_VERSION: 18.16.0
2525
RUST_VERSION: 1.73
26-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
2726

2827
jobs:
2928
build:

.github/workflows/deploy-react-components.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ concurrency:
2323
env:
2424
NODE_VERSION: 18.16.0
2525
RUST_VERSION: 1.73
26-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
2726

2827
jobs:
2928
build:

.github/workflows/deploy-rust-bindings.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ concurrency:
2323
env:
2424
NODE_VERSION: 18.16.0
2525
RUST_VERSION: 1.73 ## Make sure to update wasm-pack to 0.13 or higher when this is rust version 1.74 or higher
26-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
2726

2827
jobs:
2928
build:

.github/workflows/deploy-sdk.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ concurrency:
2323
env:
2424
NODE_VERSION: 18.16.0
2525
RUST_VERSION: 1.73
26-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
2726

2827
jobs:
2928
build:

.github/workflows/deploy-wallet-connectors.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ concurrency:
2323
env:
2424
NODE_VERSION: 18.16.0
2525
RUST_VERSION: 1.73
26-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
2726

2827
jobs:
2928
build:

.github/workflows/pipeline.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ env:
1515
DUMMY: 3 # For cache busting.
1616
NODE_VERSION: 18.16.0
1717
RUST_VERSION: 1.73
18-
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
1918

2019
jobs:
2120
deps:
@@ -311,7 +310,7 @@ jobs:
311310

312311
- name: Install formatter
313312
run: |
314-
rustup default ${{ env.RUST_FMT }}
313+
rustup default ${{ env.RUST_VERSION }}
315314
rustup component add rustfmt
316315
317316
- name: Format

packages/rust-bindings/packages/common/src/helpers.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ use crate::types::JsonString;
55

66
pub type JsResult<T = JsonString> = Result<T, JsError>;
77

8-
pub fn to_js_error(error: impl Display) -> JsError { JsError::new(&format!("{}", error)) }
8+
pub fn to_js_error(error: impl Display) -> JsError {
9+
JsError::new(&format!("{}", error))
10+
}

packages/rust-bindings/packages/wallet/src/aux_functions.rs

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ fn get_net(net: &str) -> Result<Net> {
114114
#[derive(SerdeSerialize, SerdeDeserialize)]
115115
#[serde(rename_all = "camelCase")]
116116
pub struct CredentialInput {
117-
ip_info: IpInfo<constants::IpPairing>,
118-
global_context: GlobalContext<constants::ArCurve>,
119-
ars_infos: BTreeMap<ArIdentity, ArInfo<constants::ArCurve>>,
120-
id_object: IdentityObjectV1<constants::IpPairing, constants::ArCurve, AttributeKind>,
117+
ip_info: IpInfo<constants::IpPairing>,
118+
global_context: GlobalContext<constants::ArCurve>,
119+
ars_infos: BTreeMap<ArIdentity, ArInfo<constants::ArCurve>>,
120+
id_object: IdentityObjectV1<constants::IpPairing, constants::ArCurve, AttributeKind>,
121121
revealed_attributes: Vec<AttributeTag>,
122-
seed_as_hex: HexString,
123-
net: String,
124-
identity_index: u32,
125-
cred_number: u8,
126-
expiry: TransactionTime,
122+
seed_as_hex: HexString,
123+
net: String,
124+
identity_index: u32,
125+
cred_number: u8,
126+
expiry: TransactionTime,
127127
}
128128

129129
pub fn create_credential_v1_aux(input: CredentialInput) -> Result<JsonString> {
@@ -227,7 +227,7 @@ pub fn generate_unsigned_credential_aux(input: &str) -> Result<JsonString> {
227227

228228
let public_keys: Vec<VerifyKey> = try_get(&v, "publicKeys")?;
229229
let cred_key_info = CredentialPublicKeys {
230-
keys: build_key_map(&public_keys),
230+
keys: build_key_map(&public_keys),
231231
threshold: try_get(&v, "threshold")?,
232232
};
233233

@@ -323,7 +323,7 @@ pub fn get_credential_deployment_details_aux(
323323
let acc_cred = AccountCredential::Normal { cdi };
324324

325325
let credential_message = AccountCredentialMessage {
326-
credential: acc_cred,
326+
credential: acc_cred,
327327
message_expiry: TransactionTime { seconds: expiry },
328328
};
329329

@@ -371,20 +371,20 @@ pub fn get_credential_deployment_info_aux(
371371
#[serde(rename_all = "camelCase")]
372372
pub struct IdProofInput {
373373
id_object: IdentityObjectV1<constants::IpPairing, constants::ArCurve, AttributeKind>,
374-
global_context: GlobalContext<constants::ArCurve>,
375-
seed_as_hex: String,
376-
net: String,
374+
global_context: GlobalContext<constants::ArCurve>,
375+
seed_as_hex: String,
376+
net: String,
377377
identity_provider_index: u32,
378-
identity_index: u32,
379-
cred_number: u8,
380-
statement: Statement<constants::ArCurve, AttributeKind>,
381-
challenge: String,
378+
identity_index: u32,
379+
cred_number: u8,
380+
statement: Statement<constants::ArCurve, AttributeKind>,
381+
challenge: String,
382382
}
383383

384384
#[derive(SerdeSerialize, SerdeDeserialize)]
385385
struct IdProofOutput {
386386
credential: String,
387-
proof: Versioned<Proof<constants::ArCurve, AttributeKind>>,
387+
proof: Versioned<Proof<constants::ArCurve, AttributeKind>>,
388388
}
389389

390390
pub fn create_id_proof_aux(input: IdProofInput) -> Result<JsonString> {
@@ -438,7 +438,7 @@ pub fn create_id_proof_aux(input: IdProofInput) -> Result<JsonString> {
438438

439439
let out = IdProofOutput {
440440
credential: base16_encode_string(&credential),
441-
proof: Versioned::new(VERSION_0, proof),
441+
proof: Versioned::new(VERSION_0, proof),
442442
};
443443

444444
Ok(json!(out).to_string())
@@ -450,7 +450,9 @@ struct Web3SecretKey(
450450
);
451451

452452
impl Web3IdSigner for Web3SecretKey {
453-
fn id(&self) -> concordium_base::ed25519::PublicKey { self.0.id() }
453+
fn id(&self) -> concordium_base::ed25519::PublicKey {
454+
self.0.id()
455+
}
454456

455457
fn sign(&self, msg: &impl AsRef<[u8]>) -> concordium_base::ed25519::Signature {
456458
self.0.sign(msg)
@@ -460,8 +462,8 @@ impl Web3IdSigner for Web3SecretKey {
460462
#[derive(SerdeDeserialize)]
461463
#[serde(rename_all = "camelCase")]
462464
pub struct Web3IdProofInput {
463-
request: Request<constants::ArCurve, Web3IdAttribute>,
464-
global_context: GlobalContext<constants::ArCurve>,
465+
request: Request<constants::ArCurve, Web3IdAttribute>,
466+
global_context: GlobalContext<constants::ArCurve>,
465467
commitment_inputs:
466468
Vec<OwnedCommitmentInputs<constants::ArCurve, Web3IdAttribute, Web3SecretKey>>,
467469
}
@@ -491,28 +493,28 @@ pub fn serialize_credential_deployment_payload_aux(
491493
#[derive(SerdeSerialize, SerdeDeserialize)]
492494
#[serde(rename_all = "camelCase")]
493495
pub struct UnsignedCredentialInput {
494-
ip_info: IpInfo<constants::IpPairing>,
495-
global_context: GlobalContext<constants::ArCurve>,
496-
ars_infos: BTreeMap<ArIdentity, ArInfo<constants::ArCurve>>,
496+
ip_info: IpInfo<constants::IpPairing>,
497+
global_context: GlobalContext<constants::ArCurve>,
498+
ars_infos: BTreeMap<ArIdentity, ArInfo<constants::ArCurve>>,
497499
id_object: IdentityObjectV1<constants::IpPairing, constants::ArCurve, AttributeKind>,
498-
id_cred_sec: PedersenValue<ArCurve>,
499-
prf_key: prf::SecretKey<ArCurve>,
500+
id_cred_sec: PedersenValue<ArCurve>,
501+
prf_key: prf::SecretKey<ArCurve>,
500502
sig_retrievel_randomness: String,
501-
credential_public_keys: CredentialPublicKeys,
502-
attribute_randomness: BTreeMap<AttributeTag, PedersenRandomness<ArCurve>>,
503-
revealed_attributes: Vec<AttributeTag>,
504-
cred_number: u8,
503+
credential_public_keys: CredentialPublicKeys,
504+
attribute_randomness: BTreeMap<AttributeTag, PedersenRandomness<ArCurve>>,
505+
revealed_attributes: Vec<AttributeTag>,
506+
cred_number: u8,
505507
}
506508

507509
#[derive(SerdeSerialize)]
508510
#[serde(rename_all = "camelCase")]
509511
pub struct BakerKeys {
510512
#[serde(flatten)]
511-
keys_payload: ConfigureBakerKeysPayload,
513+
keys_payload: ConfigureBakerKeysPayload,
512514
#[serde(serialize_with = "base16_encode", rename = "electionPrivateKey")]
513515
election_private_key: BakerElectionSignKey,
514516
#[serde(serialize_with = "base16_encode", rename = "signatureSignKey")]
515-
signature_sign_key: BakerSignatureSignKey,
517+
signature_sign_key: BakerSignatureSignKey,
516518
#[serde(serialize_with = "base16_encode", rename = "aggregationSignKey")]
517519
aggregation_sign_key: BakerAggregationSignKey,
518520
}
@@ -533,14 +535,14 @@ pub fn generate_baker_keys(sender: AccountAddress) -> Result<JsonString> {
533535
#[derive(SerdeDeserialize)]
534536
#[serde(rename_all = "camelCase")]
535537
pub struct VerifyWeb3IdCredentialSignatureInput {
536-
global_context: GlobalContext<constants::ArCurve>,
537-
values: BTreeMap<String, Web3IdAttribute>,
538-
randomness: BTreeMap<String, PedersenRandomness<constants::ArCurve>>,
538+
global_context: GlobalContext<constants::ArCurve>,
539+
values: BTreeMap<String, Web3IdAttribute>,
540+
randomness: BTreeMap<String, PedersenRandomness<constants::ArCurve>>,
539541
#[serde(serialize_with = "base16_encode", deserialize_with = "base16_decode")]
540-
signature: concordium_base::ed25519::Signature,
541-
holder: CredentialHolderId,
542+
signature: concordium_base::ed25519::Signature,
543+
holder: CredentialHolderId,
542544
issuer_public_key: IssuerKey,
543-
issuer_contract: ContractAddress,
545+
issuer_contract: ContractAddress,
544546
}
545547

546548
pub fn verify_web3_id_credential_signature_aux(

packages/rust-bindings/packages/wallet/src/external_functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ pub fn verify_web3_id_credential_signature_ext(raw_input: JsonString) -> JsResul
294294
#[derive(serde::Deserialize)]
295295
#[serde(rename_all = "camelCase")]
296296
struct VerifyPresentationInput {
297-
presentation: Presentation<ArCurve, Web3IdAttribute>,
297+
presentation: Presentation<ArCurve, Web3IdAttribute>,
298298
global_context: GlobalContext<ArCurve>,
299-
public_data: Vec<CredentialsInputs<ArCurve>>,
299+
public_data: Vec<CredentialsInputs<ArCurve>>,
300300
}
301301

302302
#[wasm_bindgen(js_name = verifyPresentation)]

rustfmt.toml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,2 @@
1-
edition="2018"
2-
combine_control_expr = false
3-
wrap_comments = true
4-
brace_style = "PreferSameLine"
5-
enum_discrim_align_threshold = 20
6-
fn_single_line = true
7-
format_strings = true
8-
format_macro_matchers = true
9-
format_macro_bodies = true
10-
imports_granularity = "Crate"
11-
normalize_comments = true
12-
reorder_impl_items = true
1+
edition = "2021"
132
reorder_imports = true
14-
struct_field_align_threshold = 20
15-
trailing_semicolon = true
16-
type_punctuation_density = "Wide"
17-
use_field_init_shorthand = true
18-
use_try_shorthand = true
19-
format_code_in_doc_comments = true
20-
overflow_delimited_expr = true
21-
normalize_doc_attributes = true

0 commit comments

Comments
 (0)