Skip to content

Commit fb44464

Browse files
committed
refactor(clippy): fix updated warnings for rust 1.88
1 parent 3f65dc7 commit fb44464

File tree

25 files changed

+80
-105
lines changed

25 files changed

+80
-105
lines changed

crates/attestation/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn derive_key_pair(
2222
deployment: &DeploymentId,
2323
index: u64,
2424
) -> Result<PrivateKeySigner, anyhow::Error> {
25-
let mut derivation_path = format!("m/{}/", epoch);
25+
let mut derivation_path = format!("m/{epoch}/");
2626
derivation_path.push_str(
2727
&deployment
2828
.to_string()
@@ -32,7 +32,7 @@ pub fn derive_key_pair(
3232
.collect::<Vec<String>>()
3333
.join("/"),
3434
);
35-
derivation_path.push_str(format!("/{}", index).as_str());
35+
derivation_path.push_str(format!("/{index}").as_str());
3636

3737
Ok(MnemonicBuilder::<English>::default()
3838
.derivation_path(&derivation_path)

crates/config/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl Config {
8787

8888
if let Some(path) = filename {
8989
let mut config_content = std::fs::read_to_string(path)
90-
.map_err(|e| format!("Failed to read config file: {}", e))?;
90+
.map_err(|e| format!("Failed to read config file: {e}"))?;
9191
config_content = Self::substitute_env_vars(config_content)?;
9292
figment_config = figment_config.merge(Toml::string(&config_content));
9393
}
@@ -134,7 +134,7 @@ impl Config {
134134
Ok(value) => value,
135135
Err(_) => {
136136
missing_vars.push(var_name.to_string());
137-
format!("${{{}}}", var_name)
137+
format!("${{{var_name}}}")
138138
}
139139
}
140140
});
@@ -264,7 +264,7 @@ impl DatabaseConfig {
264264
password,
265265
database,
266266
} => {
267-
let postgres_url_str = format!("postgres://{}@{}/{}", user, host, database);
267+
let postgres_url_str = format!("postgres://{user}@{host}/{database}");
268268
let mut postgres_url =
269269
Url::parse(&postgres_url_str).expect("Failed to parse database_url");
270270
postgres_url

crates/dips/src/database.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct PsqlAgreementStore {
2222

2323
fn uint256_to_bigdecimal(value: &uint256, field: &str) -> Result<BigDecimal, DipsError> {
2424
BigDecimal::from_str(&value.to_string())
25-
.map_err(|e| DipsError::InvalidVoucher(format!("{}: {}", field, e)))
25+
.map_err(|e| DipsError::InvalidVoucher(format!("{field}: {e}")))
2626
}
2727

2828
#[async_trait]

crates/dips/src/ipfs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ impl IpfsFetcher for IpfsClient {
4848
.await
4949
.map_err(|e| {
5050
tracing::warn!("Failed to fetch subgraph manifest {}: {}", file, e);
51-
DipsError::SubgraphManifestUnavailable(format!("{}: {}", file, e))
51+
DipsError::SubgraphManifestUnavailable(format!("{file}: {e}"))
5252
})?;
5353

5454
let manifest: GraphManifest = serde_yaml::from_slice(&content).map_err(|e| {
5555
tracing::warn!("Failed to parse subgraph manifest {}: {}", file, e);
56-
DipsError::InvalidSubgraphManifest(format!("{}: {}", file, e))
56+
DipsError::InvalidSubgraphManifest(format!("{file}: {e}"))
5757
})?;
5858

5959
Ok(manifest)

crates/dips/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub enum DipsError {
176176
#[cfg(feature = "rpc")]
177177
impl From<DipsError> for tonic::Status {
178178
fn from(value: DipsError) -> Self {
179-
tonic::Status::internal(format!("{}", value))
179+
tonic::Status::internal(format!("{value}"))
180180
}
181181
}
182182

@@ -679,7 +679,7 @@ mod test {
679679

680680
let res = signed.validate(&domain, &payer_addr);
681681
match error {
682-
Some(_err) => assert!(matches!(res.unwrap_err(), _err), "case: {}", name),
682+
Some(_err) => assert!(matches!(res.unwrap_err(), _err), "case: {name}"),
683683
None => assert!(res.is_ok(), "case: {}, err: {}", name, res.unwrap_err()),
684684
}
685685
}
@@ -904,7 +904,7 @@ mod test {
904904
match (out, result) {
905905
(Ok(a), Ok(b)) => assert_eq!(a.into_bytes(), b),
906906
(Err(a), Err(b)) => assert_eq!(a.to_string(), b.to_string()),
907-
(a, b) => panic!("{:?} did not match {:?}", a, b),
907+
(a, b) => panic!("{a:?} did not match {b:?}"),
908908
}
909909
}
910910

crates/dips/src/server.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,18 @@ impl IndexerDipsService for DipsServer {
128128
Err(e) => match e {
129129
// Invalid signature/authorization errors
130130
DipsError::InvalidSignature(msg) => Err(Status::invalid_argument(format!(
131-
"invalid signature: {}",
132-
msg
131+
"invalid signature: {msg}"
133132
))),
134133
DipsError::PayerNotAuthorised(addr) => Err(Status::invalid_argument(format!(
135-
"payer {} not authorized",
136-
addr
134+
"payer {addr} not authorized"
137135
))),
138136
DipsError::UnexpectedPayee { expected, actual } => {
139137
Err(Status::invalid_argument(format!(
140-
"voucher payee {} does not match expected address {}",
141-
actual, expected
138+
"voucher payee {actual} does not match expected address {expected}"
142139
)))
143140
}
144141
DipsError::SignerNotAuthorised(addr) => Err(Status::invalid_argument(format!(
145-
"signer {} not authorized",
146-
addr
142+
"signer {addr} not authorized"
147143
))),
148144

149145
// Deployment/manifest related errors - these should return Reject
@@ -159,8 +155,7 @@ impl IndexerDipsService for DipsServer {
159155

160156
// Other errors
161157
DipsError::AbiDecoding(msg) => Err(Status::invalid_argument(format!(
162-
"invalid request voucher: {}",
163-
msg
158+
"invalid request voucher: {msg}"
164159
))),
165160
_ => Err(Status::internal(e.to_string())),
166161
},

crates/monitor/src/client/subgraph_client.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ impl DeploymentClient {
8484
.await
8585
.unwrap_or_else(|_| {
8686
panic!(
87-
"Failed to initialize monitoring for deployment `{}`",
88-
deployment
87+
"Failed to initialize monitoring for deployment `{deployment}`"
8988
)
9089
}),
9190
),
@@ -119,7 +118,7 @@ impl DeploymentClient {
119118
.json(&body);
120119

121120
if let Some(token) = self.query_auth_token.as_ref() {
122-
req = req.header(header::AUTHORIZATION, format!("Bearer {}", token));
121+
req = req.header(header::AUTHORIZATION, format!("Bearer {token}"));
123122
}
124123

125124
let reqwest_response = req.send().await?;
@@ -160,7 +159,7 @@ impl DeploymentClient {
160159
.body(body);
161160

162161
if let Some(token) = self.query_auth_token.as_ref() {
163-
req = req.header(header::AUTHORIZATION, format!("Bearer {}", token));
162+
req = req.header(header::AUTHORIZATION, format!("Bearer {token}"));
164163
}
165164

166165
Ok(req.send().await?)
@@ -335,7 +334,7 @@ mod test {
335334
mock_server_local
336335
.register(
337336
Mock::given(method("POST"))
338-
.and(path(format!("/subgraphs/id/{}", deployment)))
337+
.and(path(format!("/subgraphs/id/{deployment}")))
339338
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
340339
"data": {
341340
"user": {
@@ -350,7 +349,7 @@ mod test {
350349
mock_server_remote
351350
.register(
352351
Mock::given(method("POST"))
353-
.and(path(format!("/subgraphs/id/{}", deployment)))
352+
.and(path(format!("/subgraphs/id/{deployment}")))
354353
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
355354
"data": {
356355
"user": {
@@ -415,7 +414,7 @@ mod test {
415414
mock_server_local
416415
.register(
417416
Mock::given(method("POST"))
418-
.and(path(format!("/subgraphs/id/{}", deployment)))
417+
.and(path(format!("/subgraphs/id/{deployment}")))
419418
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
420419
"data": {
421420
"user": {
@@ -430,7 +429,7 @@ mod test {
430429
mock_server_remote
431430
.register(
432431
Mock::given(method("POST"))
433-
.and(path(format!("/subgraphs/id/{}", deployment)))
432+
.and(path(format!("/subgraphs/id/{deployment}")))
434433
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
435434
"data": {
436435
"user": {
@@ -495,7 +494,7 @@ mod test {
495494
mock_server_local
496495
.register(
497496
Mock::given(method("POST"))
498-
.and(path(format!("/subgraphs/id/{}", deployment)))
497+
.and(path(format!("/subgraphs/id/{deployment}")))
499498
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
500499
"data": {
501500
"user": {
@@ -510,7 +509,7 @@ mod test {
510509
mock_server_remote
511510
.register(
512511
Mock::given(method("POST"))
513-
.and(path(format!("/subgraphs/id/{}", deployment)))
512+
.and(path(format!("/subgraphs/id/{deployment}")))
514513
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
515514
"data": {
516515
"user": {

crates/monitor/src/escrow_accounts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async fn get_escrow_accounts_v1(
133133
// payments in the name of the sender.
134134
let response = escrow_subgraph
135135
.query::<EscrowAccountQuery, _>(escrow_account::Variables {
136-
indexer: format!("{:x?}", indexer_address),
136+
indexer: format!("{indexer_address:x?}"),
137137
thaw_end_timestamp: if reject_thawing_signers {
138138
U256::ZERO.to_string()
139139
} else {

crates/profiler/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn generate_filename(
7474
// Format the datetime (YYYY-MM-DD-HH_MM_SS)
7575
let formatted_time = datetime.format("%Y-%m-%d-%H_%M_%S").to_string();
7676

77-
let filename = format!("{}-{}-{}.{}", prefix, formatted_time, counter, extension);
77+
let filename = format!("{prefix}-{formatted_time}-{counter}.{extension}");
7878
Ok(Path::new(base_path).join(filename))
7979
}
8080

crates/service/src/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn serve_metrics(host_and_port: SocketAddr) {
5252
tracing::error!("Error encoding metrics: {}", e);
5353
(
5454
StatusCode::INTERNAL_SERVER_ERROR,
55-
format!("Error encoding metrics: {}", e),
55+
format!("Error encoding metrics: {e}"),
5656
)
5757
}
5858
}

0 commit comments

Comments
 (0)