Compare Rust code online

A Rust main function with renamed bindings and a new threshold. Paste your own .rs files or Cargo.toml to compare them. Tips for Rust

Original
0 lines
Drop to load into original
Changed
0 lines
Drop to load into changed
−0+0
Original
Changed

About this Rust comparison

Rust code changes tend to be precise: a binding renamed, a type changed, a condition tightened. A Rust diff shows each of those edits in place, so you can review them without opening a full IDE.

It is useful for checking what cargo fmt or clippy --fix changed, comparing two solutions to an exercise, or reviewing a patch from a mailing list.

What changed in this sample

  • The bindings a, b and sum became x, y and total, set to 12 and 18.
  • The println! label changed from “Sum” to “Total”.
  • The if condition moved from 15 to 20, with both messages updated.

Tips for comparing Rust

After cargo fmt
Turn on Ignore whitespace to see whether formatting changed anything beyond layout.
Compare Cargo.toml
Cargo manifests are TOML; plain text or YAML highlighting reads well, and the Characters highlight shows version bumps clearly.
Split or unified
Switch to the unified view (Alt + V) to read the changes top to bottom, the way a patch is written.
Save comparisons
Saved comparisons stay in your browser; back them up to a file from the library.

How to compare Rust online

  1. Paste the older version into Original and the newer one into Changed, or open a file on each side.
  2. Check that the syntax menu says Rust, then pick split or unified view.
  3. Step through the changes with the arrows or Alt ↓, and use Settings for options such as ignoring blank lines.
  4. Save the comparison in your browser, share a link, or download it as a .diff, HTML or PDF.

Rust comparison: questions

Can I compare two .rs files?

Yes. Open or drop them on the panes and Rust highlighting is chosen automatically.

Does it check borrowing or types?

No. It is a text comparison; it does not compile or analyse the code.

Can I share the result in a code review?

Yes. Create a share link, or copy a unified diff and paste it into the review.