| Crates.io | cargo-duplicated |
| lib.rs | cargo-duplicated |
| version | 0.2.0 |
| created_at | 2025-12-23 21:12:14.347071+00 |
| updated_at | 2025-12-30 15:00:32.433355+00 |
| description | A tool to detect duplicated Rust code blocks. |
| homepage | |
| repository | https://github.com/bircni/cargo-duplicated |
| max_upload_size | |
| id | 2002345 |
| size | 87,040 |
A command-line tool to detect duplicated Rust code blocks with configurable thresholds.
dups.toml#[test] / #[cfg(test)]You need Rust installed.
cargo install cargo-duplicated
Or build locally:
cargo build --release
Find duplicated Rust code blocks
Usage: cargo-duplicated [OPTIONS] [PATH]
Arguments:
[PATH] Path to scan [default: .]
Options:
--config <CONFIG> Path to config file (defaults to <path>/dups.toml)
--format <FORMAT> Output format [default: human] [possible values: human, json]
--include-tests Include files that contain #[test] or #[cfg(test)]
--exclude <EXCLUDE> Exclude path glob (relative to root). Can be repeated.
-h, --help Print help
-V, --version Print version
Examples:
cargo-duplicated .
cargo-duplicated --format json .
cargo-duplicated --exclude "src/generated/**" --exclude "**/fixtures/**" .
cargo-duplicated --config ./configs/dups.toml .
Create a dups.toml file in the repo you want to scan. You can start from
dups-example.toml.
min_lines = 5
min_occurrences = 2
exclude = ["target/**", "src/generated/**"]
include_tests = false
Notes:
include_tests = false skips files containing #[test] or #[cfg(test)].--config flag overrides the default <path>/dups.toml.0 no duplicates, 1 duplicates found, 2 errors.cargo clippycargo test