Crates.io | warnalyzer |
lib.rs | warnalyzer |
version | 0.2.0 |
source | src |
created_at | 2019-06-07 09:51:56.52786 |
updated_at | 2021-05-20 12:42:30.822992 |
description | Show unused code from multi-crate Rust projects |
homepage | |
repository | https://github.com/est31/warnalyzer |
max_upload_size | |
id | 139613 |
size | 45,060 |
Remove unused code from multi-crate Rust projects.
The dead_code
lint family of rustc is limited to one crate only and thus can't tell whether some public API is used inside a multi-crate project or not.
This tool, warnalyzer, provides unused code detection functionality for such multi-crate projects.
RUSTFLAGS="-Z save-analysis" cargo +nightly check
.target/debug/deps/save-analysis/cratename-longhash.json
.cargo run <path-to-json>
Nightly rust is required, as save-analysis is unstable. Despite the name, warnalyzer does not use rust-analyzer (yet).
It's still early on. There are a couple of bugs of the tool.
These are the false positives known to me:
#[allow(dead_code)]
has no effectexpr
part of for pat in expr {}
is not seen as "use" of whatever the expression contains.dead_code
lint of rustc, so if something only gets used by unused code, it doesn't get reported while it should.This crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0), at your option.
See LICENSE for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.