JevMade

Sign in
← Back to guides

JevMade field notes / Rust implementation walkthrough

Sort meaningful Rust duplicates from similar-looking code

cargo-crap asks Jev whether similar Rust functions share useful logic, are worth merging, or risk missing the same bug fix.

Original by Oleksandr ProkhorenkoClassification

Listen to this guide

JevMade’s plain-English explanation

0:00 /

Our summary

Two pieces of code can look alike without doing the same job. Oleksandr Prokhorenko shows how cargo-crap, a tool for checking Rust programs, first finds similar functions. An optional Jev check then helps a developer decide which pairs deserve a closer look.

The tool sends both functions and their similarity score to Jev, an outside AI service, and asks three separate questions: what they share, whether merging would help, and whether a bug fix might miss one copy. It saves the answers for unchanged code and labels uncertain results rather than naming a confident verdict.

This is advice, not an automatic rewrite or a reason for a build to fail. Jev cannot see the callers or the code's history, and it never sees pairs the first search misses. Teams must opt in to sending their code; a failed request discards the whole AI review.

Key takeaways

  1. Separate shared logic from a shared writing pattern before deciding to merge code.
  2. Save judgments with the code, model and questions so changes cannot silently reuse old advice.
  3. Keep uncertain or incomplete advice from looking like a finished review.

The walkthrough uses cargo-crap 0.6.0. Its AI review requires an access key and explicit opt-in; building the tool yourself also requires the optional review feature. Jev receives the functions and their similarity score, not their callers or history. Confidence is a hint, not proof. No code was run or results reproduced here.

minikin.me · Original published

Read the original guide Opens the author’s site in a new tab.

Your note

Only you can see this. Clear the text and save to remove it.

Keep what you save

Sign in to keep bookmarks and private notes on every device. We email you a link; there is no password, and the same link creates your account.