Skip to content

Commit 275da9c

Browse files
committed
replaced unused format! by .to_string
Signed-off-by: Axel Nennker <[email protected]>
1 parent ac3a94e commit 275da9c

File tree

14 files changed

+41
-41
lines changed

14 files changed

+41
-41
lines changed

libindy/src/commands/anoncreds/issuer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl IssuerCommandExecutor {
187187
.map_err(|err| CommonError::InvalidStructure(format!("Cannot deserialize AttributeNames: {:?}", err)))?;
188188

189189
if attrs.is_empty() {
190-
return Err(IndyError::CommonError(CommonError::InvalidStructure(format!("List of Schema attributes is empty"))));
190+
return Err(IndyError::CommonError(CommonError::InvalidStructure("List of Schema attributes is empty".to_string())));
191191
}
192192

193193
let schema_id = Schema::schema_id(issuer_did, name, version);
@@ -440,15 +440,15 @@ impl IssuerCommandExecutor {
440440
rev_reg_info.curr_id = 1 + rev_reg_info.curr_id;
441441

442442
if rev_reg_info.curr_id > rev_reg_def.value.max_cred_num {
443-
return Err(IndyError::AnoncredsError(AnoncredsError::RevocationRegistryFull(format!("RevocationRegistryAccumulator is full"))));
443+
return Err(IndyError::AnoncredsError(AnoncredsError::RevocationRegistryFull("RevocationRegistryAccumulator is full".to_string())));
444444
}
445445

446446
if rev_reg_def.value.issuance_type == IssuanceType::ISSUANCE_ON_DEMAND {
447447
rev_reg_info.used_ids.insert(rev_reg_info.curr_id.clone());
448448
}
449449

450450
let blob_storage_reader_handle = blob_storage_reader_handle
451-
.ok_or(IndyError::CommonError(CommonError::InvalidStructure(format!("TailsReaderHandle not found"))))?;
451+
.ok_or(IndyError::CommonError(CommonError::InvalidStructure("TailsReaderHandle not found".to_string())))?;
452452

453453
let sdk_tails_accessor = SDKTailsAccessor::new(self.blob_storage_service.clone(),
454454
blob_storage_reader_handle,
@@ -695,4 +695,4 @@ impl IssuerCommandExecutor {
695695
fn _wallet_get_rev_reg_info(&self, wallet_handle: i32, key: &str) -> Result<RevocationRegistryInfo, WalletError> {
696696
self.wallet_service.get_indy_object(wallet_handle, &key, &RecordOptions::id_value(), &mut String::new())
697697
}
698-
}
698+
}

libindy/src/commands/anoncreds/tails.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl SDKTailsAccessor {
2828
tails_reader_handle: i32,
2929
rev_reg_def: &RevocationRegistryDefinitionV1) -> Result<SDKTailsAccessor, CommonError> {
3030
let tails_hash = rev_reg_def.value.tails_hash.from_base58()
31-
.map_err(|_| CommonError::InvalidState(format!("Invalid base58 for Tails hash")))?;
31+
.map_err(|_| CommonError::InvalidState("Invalid base58 for Tails hash".to_string()))?;
3232

3333
let tails_reader_handle = tails_service.open_blob(tails_reader_handle,
3434
&rev_reg_def.value.tails_location,

libindy/src/commands/did.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl DidCommandExecutor {
216216

217217
if let Some(ref did) = my_did_info.did.as_ref() {
218218
if self.wallet_service.record_exists::<Did>(wallet_handle, did)? {
219-
return Err(IndyError::DidError(DidError::AlreadyExistsError(format!("Did already exists"))));
219+
return Err(IndyError::DidError(DidError::AlreadyExistsError("Did already exists".to_string())));
220220
};
221221
}
222222

@@ -558,7 +558,7 @@ impl DidCommandExecutor {
558558
GetNymReplyResult::GetNymReplyResultV0(res) => {
559559
let gen_nym_result_data = GetNymResultDataV0::from_json(&res.data)
560560
.map_err(map_err_trace!())
561-
.map_err(|_| CommonError::InvalidState(format!("Invalid GetNymResultData json")))?;
561+
.map_err(|_| CommonError::InvalidState("Invalid GetNymResultData json".to_string()))?;
562562

563563
TheirDidInfo::new(gen_nym_result_data.dest, gen_nym_result_data.verkey)
564564
},

libindy/src/commands/ledger.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl LedgerCommandExecutor {
379379
request.remove("signature");
380380
request.remove("signatures");
381381
request
382-
}).ok_or(CommonError::InvalidState(format!("Cannot deserialize request")))?;
382+
}).ok_or(CommonError::InvalidState("Cannot deserialize request".to_string()))?;
383383

384384
let serialized_request = serialize_signature(message_without_signatures)?;
385385
let signature = self.crypto_service.sign(&my_key, &serialized_request.as_bytes().to_vec())?;
@@ -839,4 +839,4 @@ impl LedgerCommandExecutor {
839839
enum SignatureType {
840840
Single,
841841
Multi
842-
}
842+
}

libindy/src/commands/payments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl PaymentsCommandExecutor {
282282
while let Ok(Some(payment_address)) = search.fetch_next_record() {
283283
match payment_address.get_value() {
284284
Some(value) => list_addresses.push(value.to_string()),
285-
None => cb(Err(IndyError::CommonError(CommonError::InvalidState(format!("Record value not found")))))
285+
None => cb(Err(IndyError::CommonError(CommonError::InvalidState("Record value not found".to_string()))))
286286
}
287287
}
288288

libindy/src/services/anoncreds/issuer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ impl Issuer {
108108
if rev_idx.is_some() {
109109
let rev_idx = rev_idx.unwrap();
110110
let rev_reg = rev_reg
111-
.ok_or(CommonError::InvalidState(format!("RevocationRegistry not found")))?;
111+
.ok_or(CommonError::InvalidState("RevocationRegistry not found".to_string()))?;
112112
let rev_key_priv = rev_key_priv
113-
.ok_or(CommonError::InvalidState(format!("RevocationKeyPrivate not found")))?;
113+
.ok_or(CommonError::InvalidState("RevocationKeyPrivate not found".to_string()))?;
114114
let rev_reg_def = rev_reg_def
115-
.ok_or(CommonError::InvalidState(format!("RevocationRegistryDefinitionValue not found")))?;
115+
.ok_or(CommonError::InvalidState("RevocationRegistryDefinitionValue not found".to_string()))?;
116116
let rev_tails_accessor = rev_tails_accessor
117-
.ok_or(CommonError::InvalidState(format!("RevocationTailsAccessor not found")))?;
117+
.ok_or(CommonError::InvalidState("RevocationTailsAccessor not found".to_string()))?;
118118

119119
CryptoIssuer::sign_credential_with_revoc(&cred_request.prover_did,
120120
&cred_request.blinded_ms,
@@ -177,4 +177,4 @@ impl Issuer {
177177

178178
Ok(rev_reg_delta)
179179
}
180-
}
180+
}

libindy/src/services/anoncreds/prover.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ impl Prover {
183183
.ok_or(CommonError::InvalidStructure(format!("CredentialDefinition not found by id: {:?}", credential.cred_def_id)))?;
184184

185185
let rev_state = if cred_def.value.revocation.is_some() {
186-
let timestamp = cred_key.timestamp.clone().ok_or(CommonError::InvalidStructure(format!("Timestamp not found")))?;
187-
let rev_reg_id = credential.rev_reg_id.clone().ok_or(CommonError::InvalidStructure(format!("Revocation Registry Id not found")))?;
186+
let timestamp = cred_key.timestamp.clone().ok_or(CommonError::InvalidStructure("Timestamp not found".to_string()))?;
187+
let rev_reg_id = credential.rev_reg_id.clone().ok_or(CommonError::InvalidStructure("Revocation Registry Id not found".to_string()))?;
188188
let rev_states_for_timestamp = rev_states.get(&rev_reg_id)
189189
.ok_or(CommonError::InvalidStructure(format!("RevocationState not found by id: {:?}", rev_reg_id)))?;
190190
Some(rev_states_for_timestamp.get(&timestamp)
@@ -439,4 +439,4 @@ impl Prover {
439439

440440
Ok(sub_proof_request)
441441
}
442-
}
442+
}

libindy/src/services/anoncreds/verifier.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ impl Verifier {
4040
.ok_or(CommonError::InvalidStructure(format!("CredentialDefinition not found for id: {:?}", identifier.cred_def_id)))?;
4141

4242
let (rev_reg_def, rev_reg) = if cred_def.value.revocation.is_some() {
43-
let timestamp = identifier.timestamp.clone().ok_or(CommonError::InvalidStructure(format!("Timestamp not found")))?;
44-
let rev_reg_id = identifier.rev_reg_id.clone().ok_or(CommonError::InvalidStructure(format!("Revocation Registry Id not found")))?;
43+
let timestamp = identifier.timestamp.clone().ok_or(CommonError::InvalidStructure("Timestamp not found".to_string()))?;
44+
let rev_reg_id = identifier.rev_reg_id.clone().ok_or(CommonError::InvalidStructure("Revocation Registry Id not found".to_string()))?;
4545
let rev_reg_def = Some(rev_reg_defs.get(&rev_reg_id)
4646
.ok_or(CommonError::InvalidStructure(format!("RevocationRegistryDefinition not found for id: {:?}", identifier.rev_reg_id)))?);
4747
let rev_regs_for_cred = rev_regs.get(&rev_reg_id)
@@ -111,4 +111,4 @@ impl Verifier {
111111

112112
Ok(predicates_for_credential)
113113
}
114-
}
114+
}

libindy/src/services/ledger/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl LedgerService {
113113
info!("build_attrib_request >>> identifier: {:?}, dest: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", identifier, dest, hash, raw, enc);
114114

115115
if raw.is_none() && hash.is_none() && enc.is_none() {
116-
return Err(CommonError::InvalidStructure(format!("Either raw or hash or enc must be specified")));
116+
return Err(CommonError::InvalidStructure("Either raw or hash or enc must be specified".to_string()));
117117
}
118118
if let Some(ref raw) = raw {
119119
serde_json::from_str::<serde_json::Value>(raw)
@@ -138,7 +138,7 @@ impl LedgerService {
138138
info!("build_get_attrib_request >>> identifier: {:?}, dest: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", identifier, dest, hash, raw, enc);
139139

140140
if raw.is_none() && hash.is_none() && enc.is_none() {
141-
return Err(CommonError::InvalidStructure(format!("Either raw or hash or enc must be specified")));
141+
return Err(CommonError::InvalidStructure("Either raw or hash or enc must be specified".to_string()));
142142
}
143143
let operation = GetAttribOperation::new(dest.to_string(), raw, hash, enc);
144144

libindy/src/services/pool/catchup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl CatchupHandler {
239239
let index = process.pending_reps.get_min_index()?;
240240
{
241241
let &mut (ref mut first_resp, node_idx) = process.pending_reps.get_mut(index)
242-
.ok_or(CommonError::InvalidStructure(format!("Element not Found")))?;
242+
.ok_or(CommonError::InvalidStructure("Element not Found".to_string()))?;
243243
if first_resp.min_tx()? - 1 != process.merkle_tree.count() { break; }
244244

245245
let mut temp_mt = process.merkle_tree.clone();

0 commit comments

Comments
 (0)