Skip to content

Commit 985bbbb

Browse files
authored
fix new 1.81.0 warning and clippy error (#760)
* fix new 1.81.0 warning and clippy error on 1.81, this expression caused rustc warning, and clippy error: ``` warning: this function depends on never type fallback being `()` --> bin/propolis-cli/src/main.rs:497:1 | 497 | / async fn migrate_instance( 498 | | src_client: Client, 499 | | dst_client: Client, 500 | | src_addr: SocketAddr, 501 | | dst_uuid: Uuid, 502 | | disks: Vec<DiskRequest>, 503 | | ) -> anyhow::Result<()> { | |_______________________^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #123748 <rust-lang/rust#123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: FromIterator<()>` will fail --> bin/propolis-cli/src/main.rs:598:20 | 598 | .collect::<anyhow::Result<_>>()?; | ^^^^^^^^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default warning: `propolis-cli` (bin "propolis-cli") generated 1 warning ``` i am, honestly, entirely missing how the never type is involved here, or how changing the `collect`'s type from `anyhow::Result<_>` to `anyhow::Result<()>` changes things in a direction to satisfy rustc. but bounding the type further doesn't seem like it would cause a problem? * the unused pub(crate) struct warnings are new also, allow these cases
1 parent 3c38946 commit 985bbbb

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

bin/propolis-cli/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ async fn migrate_instance(
595595
.collect::<Result<Vec<_>, _>>()?
596596
// Then any errors from polling the source/destination
597597
.into_iter()
598-
.collect::<anyhow::Result<_>>()?;
598+
.collect::<anyhow::Result<()>>()?;
599599

600600
Ok(())
601601
}

bin/propolis-utils/src/bin/cpuid-gen.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,23 @@ fn create_vm() -> anyhow::Result<VmmFd> {
1616
let ctl = VmmCtlFd::open()?;
1717
let _ = unsafe { ctl.ioctl(bhyve_api::VMM_CREATE_VM, &mut req) }?;
1818

19-
let vm = VmmFd::open(&name).map_err(|e| {
20-
// Attempt to manually destroy the VM if we cannot open it
21-
let _ = ctl.vm_destroy(name.as_bytes());
22-
e
23-
})?;
24-
25-
vm.ioctl_usize(bhyve_api::ioctls::VM_SET_AUTODESTRUCT, 1).map_err(|e| {
26-
// Destroy instance if auto-destruct cannot be set
27-
let _ = vm.ioctl_usize(bhyve_api::VM_DESTROY_SELF, 0);
28-
e
29-
})?;
19+
let vm = match VmmFd::open(&name) {
20+
Ok(vm) => vm,
21+
Err(e) => {
22+
// Attempt to manually destroy the VM if we cannot open it
23+
let _ = ctl.vm_destroy(name.as_bytes());
24+
return Err(e.into());
25+
}
26+
};
27+
28+
match vm.ioctl_usize(bhyve_api::ioctls::VM_SET_AUTODESTRUCT, 1) {
29+
Ok(_res) => {}
30+
Err(e) => {
31+
// Destroy instance if auto-destruct cannot be set
32+
let _ = vm.ioctl_usize(bhyve_api::VM_DESTROY_SELF, 0);
33+
return Err(e.into());
34+
}
35+
};
3036

3137
Ok(vm)
3238
}

lib/propolis/src/firmware/smbios/bits.rs

+4
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,11 @@ pub(crate) struct Type1 {
140140
}
141141
raw_table_impl!(Type1, 1);
142142

143+
// We don't create type 2 tables yet, but it's nice to have the definition on hand.
143144
/// Type 2 (Baseboard Information)
144145
#[derive(Copy, Clone)]
145146
#[repr(C, packed)]
147+
#[allow(dead_code)]
146148
pub(crate) struct Type2 {
147149
pub header: StructureHeader,
148150
pub manufacturer: u8,
@@ -159,9 +161,11 @@ pub(crate) struct Type2 {
159161
}
160162
raw_table_impl!(Type2, 2);
161163

164+
// We don't create type 3 tables yet, but it's nice to have the definition on hand.
162165
/// Type 3 (System Enclosure) - Version 2.7
163166
#[derive(Copy, Clone)]
164167
#[repr(C, packed)]
168+
#[allow(dead_code)]
165169
pub(crate) struct Type3 {
166170
pub header: StructureHeader,
167171
pub manufacturer: u8,

0 commit comments

Comments
 (0)