chore: fix the new clippy lint in tests
Draft
FE
9d ago+11+11+01234567890123456789-11-11-01234567890123456789
What fails
The Lint job fails on every open PR, for example #119. Clippy reports 11 errors in old tests in src/emails.rs, src/events.rs and src/templates.rs.
Why
Rust 1.99.0 adds the clippy::assert_is_empty lint. The lint rejects assert!(x.is_empty()) and assert!(!x.is_empty()). CI uses the latest stable toolchain and runs clippy with -Dwarnings, so each warning is an error.
What changed
- Each flagged
assert!(x.is_empty())is nowassert_eq!against an empty value. Eachassert!(!x.is_empty())is nowassert_ne!. - For
Vecfields, the empty value isVec::<T>::new(). Clippy suggests[] as [T; 0], but the crate deniestrivial_casts, so that form does not compile. - For the
urlstring, the empty value is"", as clippy suggests.
The assertions check the same conditions as before. Only test code changes, so there is no version bump.
Verification
cargo clippy --all-targets -- -Dwarningspasses for the async,rustls-tlsandblockingconfigurations, with clippy 0.1.99.cargo fmt --checkandcargo buildpass.- The offline tests that changed pass. The live
share_emailtest needsRESEND_API_KEYand runs in CI.
This unblocks the Lint check on open PRs such as #119.
Summary by cubic
Fixes the failing Lint job on all open PRs by updating test assertions to satisfy the new clippy::assert_is_empty lint added in Rust 1.99.0.
- Replaces
assert!(x.is_empty())withassert_eq!andassert!(!x.is_empty())withassert_ne!in test code insrc/emails.rs,src/events.rs, andsrc/templates.rs. - Uses
Vec::<T>::new()as the empty value instead of[] as [T; 0], which the crate cannot compile because it deniestrivial_casts. - Only test code changes, so there is no version bump.