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<dyn Error>`.

Workspace clippy --all-targets now reports 0 errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 13:56:35 -04:00
co-authored by Claude Opus 4.8
parent 207eeaf54c
commit 585cb25fe3
+7 -5
View File
@@ -78,19 +78,21 @@ mod tests {
use super::CommandIntent;
#[test]
fn plain_text_parses_as_search() {
fn plain_text_parses_as_search() -> Result<(), Box<dyn std::error::Error>> {
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<dyn std::error::Error>> {
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(())
}
}