Skip to content

Commit 9f8ea0f

Browse files
[chore] Move to Rust v1.85 (MystenLabs#21320)
## Description A clean move to Rust v1.85. ## Test plan How did you test the new or updated feature? --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
1 parent b129eeb commit 9f8ea0f

File tree

248 files changed

+608
-629
lines changed

Some content is hidden

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

248 files changed

+608
-629
lines changed

consensus/config/src/committee.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ impl Committee {
5757
}
5858
}
5959

60-
/// -----------------------------------------------------------------------
61-
/// Accessors to Committee fields.
60+
// -----------------------------------------------------------------------
61+
// Accessors to Committee fields.
6262

6363
pub fn epoch(&self) -> Epoch {
6464
self.epoch
@@ -91,8 +91,8 @@ impl Committee {
9191
.map(|(i, a)| (AuthorityIndex(i as u32), a))
9292
}
9393

94-
/// -----------------------------------------------------------------------
95-
/// Helpers for Committee properties.
94+
// -----------------------------------------------------------------------
95+
// Helpers for Committee properties.
9696

9797
/// Returns true if the provided stake has reached quorum (2f+1).
9898
pub fn reached_quorum(&self, stake: Stake) -> bool {
@@ -104,7 +104,7 @@ impl Committee {
104104
stake >= self.validity_threshold()
105105
}
106106

107-
/// Coverts an index to an AuthorityIndex, if valid.
107+
/// Converts an index to an AuthorityIndex, if valid.
108108
/// Returns None if index is out of bound.
109109
pub fn to_authority_index(&self, index: usize) -> Option<AuthorityIndex> {
110110
if index < self.authorities.len() {

consensus/core/src/network/metrics_layer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use prometheus::HistogramTimer;
77

88
use super::metrics::NetworkRouteMetrics;
99

10-
/// Tower layer adapters that allow specifying callbacks for request and response handling
11-
/// exist for both anemo and http. So the metrics layer implementation can be reused across
12-
/// networking stacks.
10+
// Tower layer adapters that allow specifying callbacks for request and response handling
11+
// exist for both anemo and http. So the metrics layer implementation can be reused across
12+
// networking stacks.
1313

1414
pub(crate) trait SizedRequest {
1515
fn size(&self) -> usize;

consensus/core/src/test_dag_parser.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ use crate::{
5151
/// dag_builder.print(); // print the parsed DAG
5252
/// dag_builder.persist_all_blocks(dag_state.clone()); // persist all blocks to DagState
5353
/// ```
54-
5554
pub(crate) fn parse_dag(dag_string: &str) -> IResult<&str, DagBuilder> {
5655
let (input, _) = tuple((tag("DAG"), multispace0, char('{')))(dag_string)?;
5756

crates/mysten-common/src/sync/notify_read.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub struct Registration<'a, K: Eq + Hash + Clone, V: Clone> {
142142
registration: Option<(K, oneshot::Receiver<V>)>,
143143
}
144144

145-
impl<'a, K: Eq + Hash + Clone + Unpin, V: Clone + Unpin> Future for Registration<'a, K, V> {
145+
impl<K: Eq + Hash + Clone + Unpin, V: Clone + Unpin> Future for Registration<'_, K, V> {
146146
type Output = V;
147147

148148
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@@ -160,7 +160,7 @@ impl<'a, K: Eq + Hash + Clone + Unpin, V: Clone + Unpin> Future for Registration
160160
}
161161
}
162162

163-
impl<'a, K: Eq + Hash + Clone, V: Clone> Drop for Registration<'a, K, V> {
163+
impl<K: Eq + Hash + Clone, V: Clone> Drop for Registration<'_, K, V> {
164164
fn drop(&mut self) {
165165
if let Some((key, receiver)) = self.registration.take() {
166166
mem::drop(receiver);

crates/mysten-metrics/src/guards.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl<'a> GaugeGuard<'a> {
1616
}
1717
}
1818

19-
impl<'a> Drop for GaugeGuard<'a> {
19+
impl Drop for GaugeGuard<'_> {
2020
fn drop(&mut self) {
2121
self.0.dec();
2222
}
@@ -41,7 +41,7 @@ pub struct GaugeGuardFuture<'a, F: Sized> {
4141
_guard: GaugeGuard<'a>,
4242
}
4343

44-
impl<'a, F: Future> Future for GaugeGuardFuture<'a, F> {
44+
impl<F: Future> Future for GaugeGuardFuture<'_, F> {
4545
type Output = F::Output;
4646

4747
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {

crates/mysten-metrics/src/histogram.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl HistogramReporter {
309309
}
310310
}
311311

312-
impl<'a> Drop for HistogramTimerGuard<'a> {
312+
impl Drop for HistogramTimerGuard<'_> {
313313
fn drop(&mut self) {
314314
self.histogram
315315
.report(self.start.elapsed().as_millis() as u64);

crates/mysten-metrics/src/metered_channel.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'a, T> Permit<'a, T> {
162162
}
163163
}
164164

165-
impl<'a, T> Drop for Permit<'a, T> {
165+
impl<T> Drop for Permit<'_, T> {
166166
fn drop(&mut self) {
167167
// in the case the permit is dropped without sending, we still want to decrease the occupancy of the channel
168168
if self.permit.is_some() {
@@ -253,11 +253,10 @@ impl<T> Sender<T> {
253253
}
254254

255255
////////////////////////////////
256-
/// Stream API Wrappers!
256+
// Stream API Wrappers!
257257
////////////////////////////////
258258

259259
/// A wrapper around [`crate::metered_channel::Receiver`] that implements [`Stream`].
260-
///
261260
#[derive(Debug)]
262261
pub struct ReceiverStream<T> {
263262
inner: Receiver<T>,
@@ -313,7 +312,7 @@ impl<T> From<Receiver<T>> for ReceiverStream<T> {
313312
// TODO: add prom metrics reporting for gauge and migrate all existing use cases.
314313

315314
////////////////////////////////////////////////////////////////
316-
/// Constructor
315+
// Constructor
317316
////////////////////////////////////////////////////////////////
318317

319318
/// Similar to `mpsc::channel`, `channel` creates a pair of `Sender` and `Receiver`

crates/mysten-metrics/src/monitored_mpsc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'a, T> Permit<'a, T> {
169169
}
170170
}
171171

172-
impl<'a, T> Drop for Permit<'a, T> {
172+
impl<T> Drop for Permit<'_, T> {
173173
fn drop(&mut self) {
174174
// In the case the permit is dropped without sending, we still want to decrease the occupancy of the channel.
175175
// Otherwise, receiver should be responsible for decreasing the inflight gauge.

crates/sui-core/src/authority.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,8 +4425,7 @@ impl AuthorityState {
44254425
) -> SuiResult<Option<VerifiedSignedTransaction>> {
44264426
let lock_info = self
44274427
.get_object_cache_reader()
4428-
.get_lock(*object_ref, epoch_store)
4429-
.map_err(SuiError::from)?;
4428+
.get_lock(*object_ref, epoch_store)?;
44304429
let lock_info = match lock_info {
44314430
ObjectLockStatus::LockedAtDifferentVersion { locked_ref } => {
44324431
return Err(UserInputError::ObjectVersionUnavailableForConsumption {

crates/sui-core/src/authority/authority_per_epoch_store.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,7 @@ pub struct AuthorityEpochTables {
571571
#[allow(dead_code)]
572572
randomness_rounds_written: DBMap<(), ()>,
573573

574-
/// Tables for recording state for RandomnessManager.
575-
574+
// Tables for recording state for RandomnessManager.
576575
/// Records messages processed from other nodes. Updated when receiving a new dkg::Message
577576
/// via consensus.
578577
pub(crate) dkg_processed_messages_v2: DBMap<PartyId, VersionedProcessedMessage>,
@@ -1560,18 +1559,13 @@ impl AuthorityPerEpochStore {
15601559
self.consensus_quarantine.read().is_empty(),
15611560
"get_last_consensus_stats should only be called at startup"
15621561
);
1563-
match self
1564-
.tables()?
1565-
.get_last_consensus_stats()
1566-
.map_err(SuiError::from)?
1567-
{
1562+
match self.tables()?.get_last_consensus_stats()? {
15681563
Some(stats) => Ok(stats),
15691564
None => {
15701565
let indices = self
15711566
.tables()?
15721567
.get_last_consensus_index()
1573-
.map(|x| x.unwrap_or_default())
1574-
.map_err(SuiError::from)?;
1568+
.map(|x| x.unwrap_or_default())?;
15751569
Ok(ExecutionIndicesWithStats {
15761570
index: indices,
15771571
hash: 0, // unused

0 commit comments

Comments
 (0)