All contributions

mitsuhiko/insta

insta

A snapshot testing library for Rust: it stores a test's output in a file and compares later runs against it.

Language
Rust
GitHub stars
2,988
Merged changes
1
Project site
insta.rs

What we changed

The two-argument form of the assert_binary_snapshot! macro no longer ends in a semicolon, so using it at the end of a block no longer triggers a compiler warning.

What this work shows

  • Rust declarative macros (macro_rules!)
  • Rust compiler lints
  • Testing on nightly and a pinned toolchain
What was broken

The macro warned at the end of a block

An earlier change removed the trailing semicolons from the serialisation macro bodies but missed the two-argument arm of assert_binary_snapshot!. Used at the end of a block, the macro triggered the semicolon_in_expressions_from_non_local_macros warning on newer toolchains.

How we fixed it

No semicolon in the macro or the test

We removed the semicolon from that macro arm and from the call in test_binary.rs, so the test uses the macro as an expression. Without the fix the test fails on nightly, while the pinned 1.95 toolchain does not fire the lint here.

#946

Merged change

1 10 October 2026

What it taught us

A fix to one arm of a macro easily misses the others. A test that uses every arm the way a user does catches it at once, as long as we also run it on a newer compiler than the one the project pins.

More about this technology: Rust

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.