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 /

AI narration

Credits

“cargo-crap: Triaging Duplicates with TypeSafe” by Oleksandr Prokhorenko. Read the original source.

This expanded guide is an AI-narrated adaptation prepared by JevMade. It expands the source’s essential ideas, examples and caveats in JevMade’s own words and is not a word-for-word reading. The synthetic voice does not imitate the author or imply their endorsement.

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.

Keep this for later

Sign in to bookmark experiments, guides and videos, and keep notes only you can see.

Continue to sign in

We’ll bring you back to this listing.