Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ multiple_crate_versions = "allow"
dbg_macro = "deny"
# Forbid leftover `todo!` placeholders from reaching production
todo = "deny"
# Forbid explicit `panic!` calls; unreachable arms belong in `unreachable!`
panic = "deny"
12 changes: 6 additions & 6 deletions src/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn test_open_env_single() {
Commands::Open { env, .. } => {
assert_eq!(env, vec!["FOO=bar"]);
}
_other => panic!("unexpected command variant"),
_other => unreachable!("unexpected command variant"),
}
}

Expand All @@ -30,7 +30,7 @@ fn test_open_env_multiple() {
Commands::Open { env, .. } => {
assert_eq!(env, vec!["FOO=bar", "BAZ=qux"]);
}
_other => panic!("unexpected command variant"),
_other => unreachable!("unexpected command variant"),
}
}

Expand All @@ -41,7 +41,7 @@ fn test_open_env_empty_by_default() {
Commands::Open { env, .. } => {
assert!(env.is_empty());
}
_other => panic!("unexpected command variant"),
_other => unreachable!("unexpected command variant"),
}
}

Expand All @@ -52,7 +52,7 @@ fn test_open_json_flag() {
Commands::Open { json, .. } => {
assert!(json);
}
_other => panic!("unexpected command variant"),
_other => unreachable!("unexpected command variant"),
}
}

Expand All @@ -63,7 +63,7 @@ fn test_open_json_false_by_default() {
Commands::Open { json, .. } => {
assert!(!json);
}
_other => panic!("unexpected command variant"),
_other => unreachable!("unexpected command variant"),
}
}

Expand All @@ -88,6 +88,6 @@ fn test_open_env_and_json_together() {
assert!(json);
assert!(headless);
}
_other => panic!("unexpected command variant"),
_other => unreachable!("unexpected command variant"),
}
}
2 changes: 1 addition & 1 deletion src/issue/adhoc_env_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn parse_worktree_url_env_with_adhoc() {
.unwrap();
match r {
IssueRef::Adhoc { name, .. } => assert_eq!(name, "run-42"),
other => panic!("expected Adhoc, got {other:?}"),
other => unreachable!("expected Adhoc, got {other:?}"),
}
assert_eq!(opts.extra_env.len(), 1);
assert_eq!(
Expand Down
8 changes: 4 additions & 4 deletions src/issue/adhoc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn parse_bare_owner_repo() {
assert_eq!(repo, "api");
assert!(name.contains('_'), "expected adjective_noun: {name}");
}
other => panic!("expected Adhoc, got {other:?}"),
other => unreachable!("expected Adhoc, got {other:?}"),
}
}

Expand All @@ -22,7 +22,7 @@ fn parse_worktree_url_no_issue() {
assert_eq!(repo, "api");
assert!(name.contains('_'));
}
other => panic!("expected Adhoc, got {other:?}"),
other => unreachable!("expected Adhoc, got {other:?}"),
}
}

Expand All @@ -35,7 +35,7 @@ fn parse_worktree_url_no_issue_with_editor() {
assert_eq!(owner, "acme");
assert_eq!(repo, "api");
}
other => panic!("expected Adhoc, got {other:?}"),
other => unreachable!("expected Adhoc, got {other:?}"),
}
assert_eq!(opts.editor.as_deref(), Some("cursor"));
}
Expand Down Expand Up @@ -95,6 +95,6 @@ fn parse_worktree_url_adhoc_param() {
assert_eq!(repo, "api");
assert_eq!(name, "my-session");
}
other => panic!("expected Adhoc, got {other:?}"),
other => unreachable!("expected Adhoc, got {other:?}"),
}
}
Loading