fix: resolve Clippy warnings across all workspace targets
This commit is contained in:
@@ -233,7 +233,7 @@ pub(super) fn host_error(error: HostError) -> WireError {
|
||||
let (code, details) = match &error {
|
||||
HostError::AlreadyBooted => ("already_booted", json!({})),
|
||||
HostError::BootFailed { reason, report } => {
|
||||
("boot_failed", json!({"reason":reason,"fault":report.as_ref().map(fault)}))
|
||||
("boot_failed", json!({"reason":reason,"fault":report.as_deref().map(fault)}))
|
||||
}
|
||||
HostError::InvalidState { operation, status } => {
|
||||
("invalid_state", json!({"operation":operation,"status":status_name(*status)}))
|
||||
|
||||
@@ -65,7 +65,7 @@ pub struct AdvanceFramesOutcome {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum HostError {
|
||||
AlreadyBooted,
|
||||
BootFailed { reason: String, report: Option<CrashReport> },
|
||||
BootFailed { reason: String, report: Option<Box<CrashReport>> },
|
||||
InvalidState { operation: &'static str, status: HostExecutionStatus },
|
||||
FrameAdvanceWatchdogExpired { host_tick_limit: usize },
|
||||
FrameNotPublished { previous: Option<FrameId> },
|
||||
@@ -152,7 +152,7 @@ impl HeadlessHost {
|
||||
.as_ref()
|
||||
.map(CrashReport::summary)
|
||||
.unwrap_or_else(|| "cartridge crashed during boot".to_string());
|
||||
return Err(HostError::BootFailed { reason, report });
|
||||
return Err(HostError::BootFailed { reason, report: report.map(Box::new) });
|
||||
}
|
||||
if matches!(self.firmware.state, FirmwareState::HubHome(_)) {
|
||||
return Err(HostError::BootFailed {
|
||||
@@ -168,7 +168,7 @@ impl HeadlessHost {
|
||||
} else {
|
||||
Err(HostError::BootFailed {
|
||||
reason: "boot did not reach the game".to_string(),
|
||||
report: self.get_fault(),
|
||||
report: self.get_fault().map(Box::new),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,12 +330,12 @@ fn vm_init_failure_is_returned_as_structured_boot_failure() {
|
||||
let mut host = HeadlessHost::new();
|
||||
|
||||
let error = host.boot(&dir).expect_err("invalid PBX must fail boot");
|
||||
assert!(matches!(
|
||||
error,
|
||||
HostError::BootFailed { report: Some(CrashReport::VmInit { .. }), .. }
|
||||
));
|
||||
let HostError::BootFailed { report: Some(report), .. } = error else {
|
||||
panic!("expected structured boot failure: {error:?}");
|
||||
};
|
||||
assert!(matches!(report.as_ref(), CrashReport::VmInit { .. }));
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Faulted);
|
||||
assert!(matches!(host.get_fault(), Some(CrashReport::VmInit { .. })));
|
||||
assert_eq!(host.get_fault().as_ref(), Some(report.as_ref()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user