Skip to content

test(disk_usage): assert on error variants with matches!#804

Merged
demoray merged 1 commit into
mainfrom
bcaswell/disk-usage-test-matches
May 21, 2026
Merged

test(disk_usage): assert on error variants with matches!#804
demoray merged 1 commit into
mainfrom
bcaswell/disk-usage-test-matches

Conversation

@demoray
Copy link
Copy Markdown
Collaborator

@demoray demoray commented May 20, 2026

Replace .is_err() with matches!(_, Err(Error::Variant { .. })) in the disk_usage tests.

Why:

  • Catches wrong-variant regressions. Today, an unrelated change that routes one of these paths through a different Error::Other { context, .. } site still passes .is_err(). The matches! check pins the variant (and, for f64_to_u64, the context string).
  • Removes the module-level #[expect(clippy::assertions_on_result_states)] override, restoring that lint's coverage for the file.

Verified locally:

  • cargo fmt
  • cargo clippy --locked --all-targets --all-features -- -D warnings -D clippy::pedantic -A clippy::missing_errors_doc
  • cargo test --all-features (28 passed in the lib suite, 2 in convert)

@demoray demoray enabled auto-merge (squash) May 21, 2026 15:34
Replace .is_err() with matches!(_, Err(Error::Variant { .. })) in the
disk_usage tests and drop the module-level
#[expect(clippy::assertions_on_result_states)] override, restoring that
lint's coverage.
@demoray demoray force-pushed the bcaswell/disk-usage-test-matches branch from ffa27e2 to d1726e3 Compare May 21, 2026 15:36
@demoray demoray merged commit dc3ee56 into main May 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants