Expand description
Scan .nix
files for dead code (unused variable bindings).
let content = "
let
foo = {};
inherit (foo) bar baz;
in baz
";
let ast = rnix::Root::parse(content);
assert_eq!(0, ast.errors().len());
let results = deadnix::Settings {
no_lambda_arg: false,
no_lambda_pattern_names: false,
no_underscore: false,
}.find_dead_code(&ast.syntax());
for dead_code in &results {
println!("unused binding: {}", dead_code.binding.name);
}
Modules
- Dead code reporting in human-readable and JSON formats
Structs
- A Nix variable binding
- Instance of a dead binding
- Analysis settings
Enums
- AST subtree that declares variables
Functions
- Deletes
nodes
from content