cargo-crap: Finding Untested Complexity in AI-Generated Rust Code
The `cargo-crap` tool, detailed in a blog post on minikin.me and discussed on Lobsters on May 18, 2026, provides Rust developers with a method to detect and address untested complexity within their projects. It operates by analyzing Rust codebases to identify functions with high cyclomatic complexity that lack corresponding unit tests. This capability is particularly emphasized for its utility in reviewing AI-generated Rust code, which may inherently contain complex logic without adequate test coverage, posing potential maintenance and reliability challenges. By flagging these specific code segments, `cargo-crap` aims to guide developers in prioritizing testing efforts, thereby enhancing the overall robustness and maintainability of their applications. The tool integrates into the existing Rust `cargo` ecosystem, making it accessible for developers to incorporate into their build and CI/CD pipelines. Its release addresses a growing need for specialized tooling to manage the quality and testability of code increasingly produced or assisted by large language models, offering a practical approach to mitigate risks associated with unverified code. The tool's output helps developers focus their attention on critical areas, reducing the overhead of manually identifying complex, untested code and improving the efficiency of code reviews.
This tool helps developers identify and address untested complexity in Rust code, especially from AI, improving code quality and reducing future bugs.