From 585cb25fe3d38bf3689b73f306d9432d04af39b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 29 May 2026 13:56:35 -0400 Subject: [PATCH] fix(domain): drop unwrap/panic from command tests for clippy gate The workspace lints deny `clippy::unwrap_used` and `clippy::panic`, but `command.rs`'s two unit tests used `.unwrap()` and `panic!`, so `cargo clippy --workspace --all-targets -- -D warnings` (a CI gate) failed on them. Convert both to the crate's Result-returning test convention: `CommandIntent::parse(...)?` instead of `.unwrap()`, and a `return Err(...)` in the let-else instead of `panic!`. Same assertions; `DomainError` is `thiserror::Error`, so `?` flows into `Box`. Workspace clippy --all-targets now reports 0 errors. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/ely_domain/src/command.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/ely_domain/src/command.rs b/crates/ely_domain/src/command.rs index 6682e77..09a0170 100644 --- a/crates/ely_domain/src/command.rs +++ b/crates/ely_domain/src/command.rs @@ -78,19 +78,21 @@ mod tests { use super::CommandIntent; #[test] - fn plain_text_parses_as_search() { + fn plain_text_parses_as_search() -> Result<(), Box> { assert_eq!( - CommandIntent::parse("servo browser").unwrap(), + CommandIntent::parse("servo browser")?, CommandIntent::Search("servo browser".to_string()) ); + Ok(()) } #[test] - fn domain_like_text_parses_as_navigation() { - let intent = CommandIntent::parse("example.com").unwrap(); + fn domain_like_text_parses_as_navigation() -> Result<(), Box> { + let intent = CommandIntent::parse("example.com")?; let CommandIntent::Navigate(url) = intent else { - panic!("expected navigation intent"); + return Err("expected navigation intent".into()); }; assert_eq!(url.as_str(), "https://example.com"); + Ok(()) } }