feat(natu): detect single-use let bindings
This commit is contained in:
@@ -11,6 +11,7 @@ pub mod list_to_attrs_map;
|
||||
pub mod manual_inherit;
|
||||
pub mod manual_inherit_from;
|
||||
pub mod redundant_parameter_forwarding;
|
||||
pub mod single_use_binding;
|
||||
pub mod unquoted_uri;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -100,11 +101,22 @@ pub fn run_rules(file: &ast::ParsedFile, graph: &ScopeGraph, source: &str) -> Ve
|
||||
binding: None,
|
||||
expected_order: None,
|
||||
});
|
||||
let single_use_binding_diagnostics =
|
||||
single_use_binding::check(graph)
|
||||
.into_iter()
|
||||
.map(|finding| Finding {
|
||||
rule_id: "single_use_binding",
|
||||
range: finding.range,
|
||||
message: "Inline this single-use let binding",
|
||||
binding: Some(finding.name),
|
||||
expected_order: None,
|
||||
});
|
||||
|
||||
node_diagnostics
|
||||
.chain(token_diagnostics)
|
||||
.chain(let_order_diagnostics)
|
||||
.chain(redundant_parameter_forwarding_diagnostics)
|
||||
.chain(single_use_binding_diagnostics)
|
||||
.filter(|finding| !is_suppressed(source, finding.range, finding.rule_id))
|
||||
.map(|finding| Diagnostic {
|
||||
file_id: file.file_id,
|
||||
|
||||
Reference in New Issue
Block a user