Added allow-expect-in-tests / allow-unwrap-in-tests (#2328)

This PR:
* Added the clippy.toml to configure allowable expect / unwrap usage in
tests
* Removed as many expect/allow lines as possible from tests
* moved a bunch of allows to expects where possible

Note: in integration tests, non `#[test]` helper functions are not
covered by this so we had to leave a few lingering `expect(expect_used`
checks around
This commit is contained in:
Parker Thompson
2025-08-14 17:59:01 -07:00
committed by GitHub
parent 8bdb4521c9
commit a075424437
72 changed files with 38 additions and 126 deletions

View File

@@ -1,5 +1,4 @@
#![cfg(target_os = "macos")]
#![expect(clippy::unwrap_used, clippy::expect_used)]
use std::collections::HashMap;
@@ -24,6 +23,7 @@ fn skip_test() -> bool {
false
}
#[expect(clippy::expect_used)]
async fn run_test_cmd(tmp: TempDir, cmd: Vec<&str>) -> Result<ExecToolCallOutput> {
let sandbox_type = get_platform_sandbox().expect("should be able to get sandbox type");
assert_eq!(sandbox_type, SandboxType::MacosSeatbelt);
@@ -68,7 +68,6 @@ async fn truncates_output_lines() {
let tmp = TempDir::new().expect("should be able to create temp dir");
let cmd = vec!["seq", "300"];
#[expect(clippy::unwrap_used)]
let output = run_test_cmd(tmp, cmd).await.unwrap();
let expected_output = (1..=256)