Skip to content

Commit 0460c27

Browse files
authored
Repo: Update to the 2024 edition (#1425)
I have spot checked about 50 of the 300-ish hits the remaining lints have, as well as manually searching for known potentially problematic patterns, and am relatively certain that the drop order changes will not affect us. Thus the last blocker is removed, and we can update. This naturally introduced a few new minor lint issues, so those are fixed here. Closes #288
1 parent 1addbc1 commit 0460c27

File tree

27 files changed

+53
-101
lines changed

27 files changed

+53
-101
lines changed

Cargo.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ exclude = [
5454

5555
[workspace.package]
5656
rust-version = "1.88"
57-
edition = "2021"
57+
edition = "2024"
5858

5959
[workspace.dependencies]
6060
xtask_fuzz = { path = "xtask/xtask_fuzz" }
@@ -611,12 +611,6 @@ pbjson-build = { git = "https://github.com/jstarks/pbjson", branch = "aliases" }
611611
future_incompatible = { level = "deny", priority = -2 }
612612
rust_2018_idioms = { level = "warn", priority = -2 }
613613

614-
rust-2024-compatibility = { level = "warn", priority = -1 }
615-
edition_2024_expr_fragment_specifier = "allow"
616-
# TODO: Fix all of the below, https://github.com/microsoft/openvmm/issues/288
617-
tail-expr-drop-order = "allow"
618-
if-let-rescope = "allow"
619-
620614
unused_qualifications = "warn"
621615
missing_docs = "warn"
622616

Guide/mdbook-openvmm-shim/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[package]
55
name = "mdbook-openvmm-shim"
6-
edition = "2021"
6+
edition = "2024"
77

88
[package.metadata.xtask.house-rules]
99
# emits a binary, where kebab-case is more natural

flowey/flowey_core/src/node.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,7 +2393,7 @@ mod node_luts {
23932393
pub(super) fn modpath_by_node_typeid() -> &'static HashMap<NodeHandle, &'static str> {
23942394
static TYPEID_TO_MODPATH: OnceLock<HashMap<NodeHandle, &'static str>> = OnceLock::new();
23952395

2396-
let lookup = TYPEID_TO_MODPATH.get_or_init(|| {
2396+
TYPEID_TO_MODPATH.get_or_init(|| {
23972397
let mut lookup = HashMap::new();
23982398
for crate::node::private::FlowNodeMeta {
23992399
module_path,
@@ -2413,9 +2413,7 @@ mod node_luts {
24132413
}
24142414

24152415
lookup
2416-
});
2417-
2418-
lookup
2416+
})
24192417
}
24202418

24212419
pub(super) fn erased_node_by_typeid()
@@ -2424,7 +2422,7 @@ mod node_luts {
24242422
HashMap<NodeHandle, fn() -> Box<dyn FlowNodeBase<Request = Box<[u8]>>>>,
24252423
> = OnceLock::new();
24262424

2427-
let lookup = LOOKUP.get_or_init(|| {
2425+
LOOKUP.get_or_init(|| {
24282426
let mut lookup = HashMap::new();
24292427
for crate::node::private::FlowNodeMeta {
24302428
module_path: _,
@@ -2439,9 +2437,7 @@ mod node_luts {
24392437
}
24402438

24412439
lookup
2442-
});
2443-
2444-
lookup
2440+
})
24452441
}
24462442

24472443
pub(super) fn erased_node_by_modpath() -> &'static HashMap<
@@ -2461,7 +2457,7 @@ mod node_luts {
24612457
>,
24622458
> = OnceLock::new();
24632459

2464-
let lookup = MODPATH_LOOKUP.get_or_init(|| {
2460+
MODPATH_LOOKUP.get_or_init(|| {
24652461
let mut lookup = HashMap::new();
24662462
for crate::node::private::FlowNodeMeta { module_path, ctor, get_typeid } in crate::node::private::FLOW_NODES {
24672463
let existing = lookup.insert(module_path.strip_suffix("::_only_one_call_to_flowey_node_per_module").unwrap(), (NodeHandle(get_typeid()), *ctor));
@@ -2470,9 +2466,7 @@ mod node_luts {
24702466
}
24712467
}
24722468
lookup
2473-
});
2474-
2475-
lookup
2469+
})
24762470
}
24772471
}
24782472

flowey/flowey_core/src/patch.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,15 @@ where
9898
pub fn patchfn_by_modpath() -> &'static BTreeMap<String, PatchFn> {
9999
static MODPATH_LOOKUP: OnceLock<BTreeMap<String, PatchFn>> = OnceLock::new();
100100

101-
let lookup = MODPATH_LOOKUP.get_or_init(|| {
101+
MODPATH_LOOKUP.get_or_init(|| {
102102
let mut lookup = BTreeMap::new();
103103
for (f, module_path, fn_name) in private::PATCH_FNS {
104104
let existing = lookup.insert(format!("{}::{}", module_path, fn_name), *f);
105105
// Rust would've errored out at module defn time with a duplicate fn name error
106106
assert!(existing.is_none());
107107
}
108108
lookup
109-
});
110-
111-
lookup
109+
})
112110
}
113111

114112
/// [`PatchResolver`]

openhcl/ohcldiag-dev/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ fn create_or_stderr(path: &Option<PathBuf>) -> std::io::Result<fs_err::File> {
895895

896896
async fn capture_packets(
897897
client: DiagClient,
898-
streams: Vec<impl std::future::Future<Output = Result<u64, std::io::Error>>>,
898+
streams: Vec<impl Future<Output = Result<u64, std::io::Error>>>,
899899
capture_duration: Duration,
900900
) {
901901
let mut capture_streams = FuturesUnordered::from_iter(streams);

openhcl/openhcl_boot/src/arch/x86_64/address_space.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ unsafe fn get_pde_for_va(va: u64) -> &'static mut PageTableEntry {
244244
let entry = pdpt.entry(va, 2);
245245
assert!(entry.is_present());
246246
let pd = page_table_at_address(entry.get_addr());
247-
let entry = pd.entry(va, 1);
248-
entry
247+
pd.entry(va, 1)
249248
}
250249
}
251250

openhcl/underhill_attestation/src/igvm_attest/wrapped_key.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ mod tests {
201201
let payload = result.unwrap();
202202

203203
let header = openhcl_attestation_protocol::igvm_attest::get::IgvmAttestWrappedKeyResponseHeader::new_zeroed();
204-
let response = [header.as_bytes(), payload.as_bytes()].concat();
205-
206-
response
204+
[header.as_bytes(), payload.as_bytes()].concat()
207205
}
208206

209207
#[test]

openhcl/underhill_core/src/emuplat/netvsp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ impl HclNetworkVFManager {
986986
) -> anyhow::Result<Box<dyn netvsp::VirtualFunction>>
987987
where
988988
F: Fn(bool) -> R + Sync + Send + 'static,
989-
R: std::future::Future<Output = bool> + Send,
989+
R: Future<Output = bool> + Send,
990990
{
991991
let (tx_update, rx_update) = mesh::channel();
992992
let guest_state = self
@@ -1095,7 +1095,7 @@ impl<F> HclNetworkVFManagerInstance<F> {
10951095
impl<F, R> netvsp::VirtualFunction for HclNetworkVFManagerInstance<F>
10961096
where
10971097
F: Fn(bool) -> R + Sync + Send + 'static,
1098-
R: std::future::Future<Output = bool> + Send,
1098+
R: Future<Output = bool> + Send,
10991099
{
11001100
async fn id(&self) -> Option<u32> {
11011101
self.guest_state.vtl0_vfid().await

support/clap_dyn_complete/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ pub trait CustomCompleterFactory: Send + Sync {
286286
type CustomCompleter: CustomCompleter + 'static;
287287

288288
/// Build a new [`CustomCompleter`].
289-
fn build(&self, ctx: &RootCtx<'_>) -> impl std::future::Future<Output = Self::CustomCompleter>;
289+
fn build(&self, ctx: &RootCtx<'_>) -> impl Future<Output = Self::CustomCompleter>;
290290
}
291291

292292
/// A custom completer for a particular argument.
@@ -297,7 +297,7 @@ pub trait CustomCompleter: Send + Sync {
297297
ctx: &RootCtx<'_>,
298298
subcommand_path: &[&str],
299299
arg_id: &str,
300-
) -> impl Send + std::future::Future<Output = Vec<String>>;
300+
) -> impl Send + Future<Output = Vec<String>>;
301301
}
302302

303303
#[async_trait::async_trait]

support/mesh/mesh_channel_core/src/oneshot.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,13 @@ impl OneshotReceiverCore {
368368
// avoid taking the lock here. A naive implementation would require
369369
// extra storage in `OneshotReceiverCore` to remember this, which is
370370
// probably undesirable.
371-
let v = if let SlotState::Sent(value) =
371+
if let SlotState::Sent(value) =
372372
std::mem::replace(&mut *slot.state.lock(), SlotState::Done)
373373
{
374374
Some(value)
375375
} else {
376376
None
377-
};
378-
v
377+
}
379378
}
380379
if let Some(v) = clear(self) {
381380
// SAFETY: the value is of type `T`.

0 commit comments

Comments
 (0)