cargo-rustcop-0.1.2 is not a library.
RustCop
An experimental Rust style linter and formatter inspired by C#'s StyleCop.
RustCop checks and auto-fixes style violations in your Rust source files, starting with import statement formatting.
Installation
Usage
Check for violations
Scans .rs files and reports style violations without modifying anything. Exits with code 1 if any diagnostics are found.
Auto-fix violations
Fixes violations in-place and runs a verification pass to confirm everything is clean.
If no paths are given, both commands default to the current directory.
Options
| Flag | Description |
|---|---|
-c, --config <FILE> |
Path to the config file (default: rustcop.toml) |
Configuration
Create a rustcop.toml in your project root:
[]
= true
= true # Group imports: std → external → crate/self/super
= true # Sort imports alphabetically within each group
= true # Merge imports from the same crate into one `use` block
Rules
| ID | Name | Description |
|---|---|---|
| RC1001 | ImportFormatting | Groups, sorts, and merges use statements |
Import formatting follows rustfmt conventions:
- Grouping — standard library first, then third-party crates, then internal (
crate/self/super), separated by blank lines. - Sorting — alphabetical within each group.
- Merging — multiple imports from the same crate are combined into a single
useblock. - Multi-line expansion — imports with nested braces are expanded to one item per line.
License
Licensed under either of
at your option.