Skip to content

Commit 6cf5727

Browse files
authored
chore: upgrade rust to 1.73.0 (#14167)
## Description Main motivation is to pick up some new changes such as rust-lang/rust#115659 Most changes here are autogenerated by the new formatter NFC ## Test Plan Existing --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
1 parent 2b532bc commit 6cf5727

File tree

196 files changed

+926
-740
lines changed

Some content is hidden

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

196 files changed

+926
-740
lines changed

.cargo/config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ move-clippy = [
2222
"-Aclippy::new_without_default",
2323
"-Aclippy::box_default",
2424
"-Aclippy::manual_slice_size_calculation",
25+
"-Aclippy::unwrap-or-default",
26+
"-Aclippy::incorrect_partial_ord_impl_on_ord_type",
27+
"-Aclippy::useless_attribute",
28+
"-Aclippy::manual_while_let_some",
29+
"-Aclippy::redundant_closure",
2530
]
2631

2732
[build]

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ impl NotifyOnce {
3535
/// This method returns errors if called more then once
3636
#[allow(clippy::result_unit_err)]
3737
pub fn notify(&self) -> Result<(), ()> {
38-
let Some(notify) = self.notify.lock().take() else { return Err(()) };
38+
let Some(notify) = self.notify.lock().take() else {
39+
return Err(());
40+
};
3941
// At this point all `register` either registered with current notify,
4042
// or will be returning immediately
4143
notify.notify_waiters();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ impl<K: Eq + Hash + Clone, V: Clone> NotifyRead<K, V> {
9696
fn cleanup(&self, key: &K) {
9797
let mut pending = self.pending(key);
9898
// it is possible that registration was fulfilled before we get here
99-
let Some(registrations) = pending.get_mut(key) else { return; };
99+
let Some(registrations) = pending.get_mut(key) else {
100+
return;
101+
};
100102
let mut count_deleted = 0usize;
101103
registrations.retain(|s| {
102104
let delete = s.is_closed();

crates/mysten-metrics/src/histogram.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl HistogramVec {
109109
register_int_counter_vec_with_registry!(sum_name, desc, labels, registry).unwrap();
110110
let count =
111111
register_int_counter_vec_with_registry!(count_name, desc, labels, registry).unwrap();
112-
let labels: Vec<_> = labels.iter().cloned().chain(["pct"].into_iter()).collect();
112+
let labels: Vec<_> = labels.iter().cloned().chain(["pct"]).collect();
113113
let gauge = register_int_gauge_vec_with_registry!(name, desc, &labels, registry).unwrap();
114114
Self::new(gauge, sum, count, percentiles, name)
115115
}

crates/mysten-metrics/src/metered_channel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use tokio::sync::mpsc::{
1717
#[path = "tests/metered_channel_tests.rs"]
1818
mod metered_channel_tests;
1919

20-
/// An [`mpsc::Sender`](tokio::sync::mpsc::Sender) with an [`IntGauge`]
20+
/// An [`mpsc::Sender`] with an [`IntGauge`]
2121
/// counting the number of currently queued items.
2222
#[derive(Debug)]
2323
pub struct Sender<T> {
@@ -34,7 +34,7 @@ impl<T> Clone for Sender<T> {
3434
}
3535
}
3636

37-
/// An [`mpsc::Receiver`](tokio::sync::mpsc::Receiver) with an [`IntGauge`]
37+
/// An [`mpsc::Receiver`] with an [`IntGauge`]
3838
/// counting the number of currently queued items.
3939
#[derive(Debug)]
4040
pub struct Receiver<T> {

crates/sui-aws-orchestrator/src/measurement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<T: BenchmarkType> MeasurementsCollection<T> {
198198
pub fn add(&mut self, scraper_id: ScraperId, measurement: Measurement) {
199199
self.scrapers
200200
.entry(scraper_id)
201-
.or_insert_with(Vec::new)
201+
.or_default()
202202
.push(measurement);
203203
}
204204

crates/sui-aws-orchestrator/src/protocol/sui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl ProtocolMetrics for SuiProtocol {
259259
.validator_config_info
260260
.expect("No validator in genesis")
261261
.iter()
262-
.zip(instances.into_iter())
262+
.zip(instances)
263263
.map(|(config, instance)| {
264264
let path = format!(
265265
"{}:{}{}",

crates/sui-benchmark/src/bank.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl BenchmarkBank {
9898
async fn pay_sui(
9999
&mut self,
100100
coin_configs: &[GasCoinConfig],
101-
mut init_coin: &mut Gas,
101+
init_coin: &mut Gas,
102102
gas_price: u64,
103103
) -> Result<UpdatedAndNewlyMintedGasCoins> {
104104
let recipient_addresses: Vec<SuiAddress> = coin_configs.iter().map(|g| g.address).collect();

crates/sui-cluster-test/src/test_case/shared_object_test.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ impl TestCaseImpl for SharedCounterTest {
6363
.mutated()
6464
.iter()
6565
.find_map(|obj| {
66-
let Owner::Shared { initial_shared_version } = obj.owner else {
67-
return None
66+
let Owner::Shared {
67+
initial_shared_version,
68+
} = obj.owner
69+
else {
70+
return None;
6871
};
6972

7073
if obj.reference.object_id == counter_id

crates/sui-core/src/authority.rs

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,8 +1670,10 @@ impl AuthorityState {
16701670
);
16711671
assert_eq!(new_object.version(), oref.1, "tx_digest={:?} error processing object owner index, object {:?} from written has mismatched version. Actual: {}, expected: {}", tx_digest, id, new_object.version(), oref.1);
16721672

1673-
let Some(df_info) = self.try_create_dynamic_field_info(new_object, written, module_resolver)
1674-
.expect("try_create_dynamic_field_info should not fail.") else {
1673+
let Some(df_info) = self
1674+
.try_create_dynamic_field_info(new_object, written, module_resolver)
1675+
.expect("try_create_dynamic_field_info should not fail.")
1676+
else {
16751677
// Skip indexing for non dynamic field objects.
16761678
continue;
16771679
};
@@ -2109,8 +2111,8 @@ impl AuthorityState {
21092111
genesis_objects: &[Object],
21102112
epoch_store: &Arc<AuthorityPerEpochStore>,
21112113
) -> SuiResult {
2112-
let Some(index_store) = &self.indexes else{
2113-
return Ok(())
2114+
let Some(index_store) = &self.indexes else {
2115+
return Ok(());
21142116
};
21152117
if !index_store.is_empty() {
21162118
return Ok(());
@@ -2126,7 +2128,12 @@ impl AuthorityState {
21262128
)),
21272129
Owner::ObjectOwner(object_id) => {
21282130
let id = o.id();
2129-
let Some(info) = self.try_create_dynamic_field_info(o, &BTreeMap::new(), epoch_store.module_cache())? else{
2131+
let Some(info) = self.try_create_dynamic_field_info(
2132+
o,
2133+
&BTreeMap::new(),
2134+
epoch_store.module_cache(),
2135+
)?
2136+
else {
21302137
continue;
21312138
};
21322139
new_dynamic_fields.push(((ObjectID::from(object_id), id), info));
@@ -2532,15 +2539,19 @@ impl AuthorityState {
25322539
epoch_store: &AuthorityPerEpochStore,
25332540
) -> SuiResult<Option<VerifiedCheckpoint>> {
25342541
let checkpoint = self.get_transaction_checkpoint_sequence(digest, epoch_store)?;
2535-
let Some(checkpoint) = checkpoint else { return Ok(None); };
2542+
let Some(checkpoint) = checkpoint else {
2543+
return Ok(None);
2544+
};
25362545
let checkpoint = self
25372546
.checkpoint_store
25382547
.get_checkpoint_by_sequence_number(checkpoint)?;
25392548
Ok(checkpoint)
25402549
}
25412550

25422551
pub fn get_object_read(&self, object_id: &ObjectID) -> SuiResult<ObjectRead> {
2543-
let Some((object_key, store_object)) = self.database.get_latest_object_or_tombstone(*object_id)? else {
2552+
let Some((object_key, store_object)) =
2553+
self.database.get_latest_object_or_tombstone(*object_id)?
2554+
else {
25442555
return Ok(ObjectRead::NotExists(*object_id));
25452556
};
25462557
if let Some(object_ref) = self
@@ -2608,7 +2619,10 @@ impl AuthorityState {
26082619
version: SequenceNumber,
26092620
) -> SuiResult<PastObjectRead> {
26102621
// Firstly we see if the object ever existed by getting its latest data
2611-
let Some(obj_ref) = self.database.get_latest_object_ref_or_tombstone(*object_id)? else {
2622+
let Some(obj_ref) = self
2623+
.database
2624+
.get_latest_object_ref_or_tombstone(*object_id)?
2625+
else {
26122626
return Ok(PastObjectRead::ObjectNotExists(*object_id));
26132627
};
26142628

@@ -3626,7 +3640,9 @@ impl AuthorityState {
36263640
system_package.dependencies().to_vec(),
36273641
max_binary_format_version,
36283642
no_extraneous_module_bytes,
3629-
).await else {
3643+
)
3644+
.await
3645+
else {
36303646
return vec![];
36313647
};
36323648
results.push(obj_ref);
@@ -3908,11 +3924,14 @@ impl AuthorityState {
39083924
// since system packages are created during the current epoch, they should abide by the
39093925
// rules of the current epoch, including the current epoch's max Move binary format version
39103926
let config = epoch_store.protocol_config();
3911-
let Some(next_epoch_system_package_bytes) = self.get_system_package_bytes(
3912-
next_epoch_system_packages.clone(),
3913-
config.move_binary_format_version(),
3914-
config.no_extraneous_module_bytes(),
3915-
).await else {
3927+
let Some(next_epoch_system_package_bytes) = self
3928+
.get_system_package_bytes(
3929+
next_epoch_system_packages.clone(),
3930+
config.move_binary_format_version(),
3931+
config.no_extraneous_module_bytes(),
3932+
)
3933+
.await
3934+
else {
39163935
error!(
39173936
"upgraded system packages {:?} are not locally available, cannot create \
39183937
ChangeEpochTx. validator binary must be upgraded to the correct version!",
@@ -3926,7 +3945,9 @@ impl AuthorityState {
39263945
// state sync, and execute it. This will upgrade the framework packages, reconfigure,
39273946
// and most likely shut down in the new epoch (this validator likely doesn't support
39283947
// the new protocol version, or else it should have had the packages.)
3929-
return Err(anyhow!("missing system packages: cannot form ChangeEpochTx"));
3948+
return Err(anyhow!(
3949+
"missing system packages: cannot form ChangeEpochTx"
3950+
));
39303951
};
39313952

39323953
let tx = if epoch_store

0 commit comments

Comments
 (0)