Skip to content

Commit 896dd56

Browse files
committed
chore: bump rust toolchain to 1.95.0
1 parent f8485fe commit 896dd56

11 files changed

Lines changed: 32 additions & 38 deletions

File tree

crates/class-hash/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,17 +466,15 @@ pub fn prepare_json_contract_definition(
466466
.context("Program attribute was not an object")?;
467467

468468
match vals.get_mut("accessible_scopes") {
469-
Some(serde_json::Value::Array(array)) => {
470-
if array.is_empty() {
471-
vals.remove("accessible_scopes");
472-
}
469+
Some(serde_json::Value::Array(array)) if array.is_empty() => {
470+
vals.remove("accessible_scopes");
473471
}
472+
Some(serde_json::Value::Array(_)) | None => {}
474473
Some(_other) => {
475474
anyhow::bail!(
476475
r#"A program's attribute["accessible_scopes"] was not an array type."#
477476
);
478477
}
479-
None => {}
480478
}
481479
// We don't know what this type is supposed to be, but if its missing it is
482480
// null.

crates/crypto/src/algebra/field/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub const fn const_adc(a: u64, b: u64, carry: u64) -> (u64, u64) {
1010
#[inline(always)]
1111
pub fn adc(a: &mut u64, b: u64, carry: u8) -> u8 {
1212
#[cfg(target_arch = "x86_64")]
13-
unsafe {
13+
{
1414
core::arch::x86_64::_addcarry_u64(carry, *a, b, a)
1515
}
1616

@@ -42,7 +42,7 @@ pub const fn const_sbb(a: u64, b: u64, borrow: u64) -> (u64, u64) {
4242
#[inline(always)]
4343
pub fn sbb(a: &mut u64, b: u64, borrow: u8) -> u8 {
4444
#[cfg(target_arch = "x86_64")]
45-
unsafe {
45+
{
4646
core::arch::x86_64::_subborrow_u64(borrow, *a, b, a)
4747
}
4848

crates/executor/src/types.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,9 @@ impl ConsensusPriceConverter {
128128
pub fn eth_l2_gas_price(&self) -> u128 {
129129
// Derive WEI price from the FRI price using the L1 gas price ratio.
130130
// l2_gas_price_wei = l2_gas_price_fri * l1_gas_price_wei / l1_gas_price_fri
131-
if self.l1_gas_price_fri == 0 {
132-
0
133-
} else {
134-
self.l2_gas_price_fri * self.l1_gas_price_wei / self.l1_gas_price_fri
135-
}
131+
(self.l2_gas_price_fri * self.l1_gas_price_wei)
132+
.checked_div(self.l1_gas_price_fri)
133+
.unwrap_or_default()
136134
}
137135
}
138136

crates/p2p/src/core/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<C> Client<C> {
7777
while let Some(partial_result) = receiver.recv().await {
7878
let more_peers =
7979
partial_result.with_context(|| format!("Getting closest peers to {peer}"))?;
80-
peers.extend(more_peers.into_iter());
80+
peers.extend(more_peers);
8181
}
8282

8383
Ok(peers)

crates/p2p/src/main_loop.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,14 +433,12 @@ where
433433
}
434434
kad::Event::RoutingUpdated {
435435
peer, is_new_peer, ..
436-
} => {
437-
if is_new_peer {
438-
send_test_event(
439-
&self._core_test_event_sender,
440-
TestEvent::PeerAddedToDHT { remote: peer },
441-
)
442-
.await
443-
}
436+
} if is_new_peer => {
437+
send_test_event(
438+
&self._core_test_event_sender,
439+
TestEvent::PeerAddedToDHT { remote: peer },
440+
)
441+
.await
444442
}
445443
_ => {}
446444
},

crates/pathfinder/src/state/sync/l2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ pub async fn download_new_classes(
782782

783783
let missing = new_classes
784784
.into_iter()
785-
.zip(exists.into_iter())
785+
.zip(exists)
786786
.filter_map(|(class, exist)| (!exist).then_some(class))
787787
.collect::<HashSet<_>>();
788788

crates/rpc/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ mod tests {
564564
mod rpc_error_subset {
565565
use assert_matches::assert_matches;
566566

567-
use super::super::{generate_rpc_error_subset, ApplicationError};
567+
use super::super::ApplicationError;
568568

569569
#[test]
570570
fn no_variant() {

crates/rpc/src/jsonrpc/router.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ where
383383
indexed_results.push(indexed_result)
384384
}
385385

386-
indexed_results.sort_by(|(index_a, _), (index_b, _)| index_a.cmp(index_b));
386+
indexed_results.sort_by_key(|(index, _)| *index);
387387

388388
indexed_results.into_iter().map(|(_index, result)| result)
389389
}
@@ -543,21 +543,21 @@ mod tests {
543543
)]
544544
#[case::invalid_request_object(
545545
json!({"jsonrpc": "2.0", "method": 1, "params": "bar"}),
546-
json!({"jsonrpc": "2.0", "id": null,
546+
json!({"jsonrpc": "2.0", "id": null,
547547
"error": {"code": -32600, "message": "Invalid request", "data": {
548548
"reason": "invalid type: integer `1`, expected a string at line 1 column 27"
549549
}}}),
550550
)]
551551
#[case::empty_batch(
552552
json!([]),
553-
json!({"jsonrpc": "2.0", "id": null,
553+
json!({"jsonrpc": "2.0", "id": null,
554554
"error": {"code": -32600, "message": "Invalid request", "data": {
555555
"reason": "A batch request must contain at least one request"
556556
}}}),
557557
)]
558558
#[case::invalid_batch_single(
559559
json!([1]),
560-
json!([{"jsonrpc": "2.0", "id": null,
560+
json!([{"jsonrpc": "2.0", "id": null,
561561
"error": {"code": -32600, "message": "Invalid request", "data": {
562562
"reason": "invalid type: integer `1`, expected struct Helper at line 1 column 1"
563563
}}}
@@ -566,15 +566,15 @@ mod tests {
566566
#[case::invalid_batch_multiple(
567567
json!([1, 2, 3]),
568568
json!([
569-
{"jsonrpc": "2.0", "id": null,
569+
{"jsonrpc": "2.0", "id": null,
570570
"error": {"code": -32600, "message": "Invalid request", "data": {
571571
"reason": "invalid type: integer `1`, expected struct Helper at line 1 column 1"
572572
}}},
573-
{"jsonrpc": "2.0", "id": null,
573+
{"jsonrpc": "2.0", "id": null,
574574
"error": {"code": -32600, "message": "Invalid request", "data": {
575575
"reason": "invalid type: integer `2`, expected struct Helper at line 1 column 1"
576576
}}},
577-
{"jsonrpc": "2.0", "id": null,
577+
{"jsonrpc": "2.0", "id": null,
578578
"error": {"code": -32600, "message": "Invalid request", "data": {
579579
"reason": "invalid type: integer `3`, expected struct Helper at line 1 column 1"
580580
}}},
@@ -592,7 +592,7 @@ mod tests {
592592
json!([
593593
{"jsonrpc": "2.0", "result": 7, "id": "1"},
594594
{"jsonrpc": "2.0", "result": 19, "id": "2"},
595-
{"jsonrpc": "2.0", "id": null, "error":
595+
{"jsonrpc": "2.0", "id": null, "error":
596596
{"code": -32600, "message": "Invalid request", "data": {
597597
"reason": "missing field `jsonrpc` at line 1 column 13"
598598
}}},

crates/rpc/src/method/trace_block_transactions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub async fn trace_block_transactions(
237237
let traces = trace
238238
.traces
239239
.into_iter()
240-
.zip(transactions.into_iter())
240+
.zip(transactions)
241241
.map(|(trace, tx)| Ok((tx.hash, map_gateway_trace(tx, trace)?)))
242242
.collect::<Result<Vec<_>, TraceBlockTransactionsError>>()?;
243243
let output_format = if return_initial_reads {

crates/storage/src/connection/state_update.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ impl Transaction<'_> {
228228
// cater for them here. This works because the sql only updates the row
229229
// if it is null.
230230
let deployed = contract_updates
231-
.iter()
232-
.filter_map(|(_, update)| match update.class {
231+
.values()
232+
.filter_map(|update| match update.class {
233233
Some(ContractClassUpdate::Deploy(x)) => Some(x),
234234
_ => None,
235235
});
@@ -266,7 +266,7 @@ impl Transaction<'_> {
266266
const PREFIX: &str = r"
267267
SELECT b1.number, b1.hash, b1.state_commitment, b2.state_commitment
268268
FROM block_headers b1
269-
LEFT OUTER JOIN block_headers b2
269+
LEFT OUTER JOIN block_headers b2
270270
ON b2.number = b1.number - 1
271271
";
272272

@@ -436,7 +436,7 @@ impl Transaction<'_> {
436436
SELECT
437437
ch1.hash AS class_hash,
438438
ch1.compiled_class_hash AS casm_hash
439-
FROM
439+
FROM
440440
casm_class_hashes ch1
441441
LEFT OUTER JOIN
442442
casm_class_hashes ch2 ON ch1.hash = ch2.hash AND ch2.block_number < ch1.block_number
@@ -504,7 +504,7 @@ impl Transaction<'_> {
504504
pub fn highest_block_with_state_update(&self) -> anyhow::Result<Option<BlockNumber>> {
505505
let mut stmt = self.inner().prepare_cached(
506506
r"
507-
SELECT max(storage_update.last_block, nonce_update.last_block, class_definition.last_block)
507+
SELECT max(storage_update.last_block, nonce_update.last_block, class_definition.last_block)
508508
FROM
509509
(SELECT max(block_number) last_block FROM storage_updates) storage_update,
510510
(SELECT max(block_number) last_block FROM nonce_updates) nonce_update,

0 commit comments

Comments
 (0)