mirror of
https://github.com/astro/deadnix.git
synced 2024-09-17 13:17:18 +03:00
delint
This commit is contained in:
parent
be51621be5
commit
1f768bd4cf
@ -105,7 +105,7 @@ fn dead_to_edit(dead_code: DeadCode) -> Option<Edit> {
|
||||
}
|
||||
|
||||
Scope::LambdaArg(name, _) => {
|
||||
replacement = Some(format!("_{}", name));
|
||||
replacement = Some(format!("_{name}"));
|
||||
}
|
||||
|
||||
Scope::LetIn(let_in) => {
|
||||
|
14
src/main.rs
14
src/main.rs
@ -170,7 +170,7 @@ fn main() {
|
||||
Err(error) => {
|
||||
match output_format {
|
||||
OutputFormat::HumanReadable => {
|
||||
eprintln!("Error stating file {}: {}", path, error);
|
||||
eprintln!("Error stating file {path}: {error}");
|
||||
}
|
||||
|
||||
#[cfg(feature = "json-out")]
|
||||
@ -179,7 +179,7 @@ fn main() {
|
||||
json!({
|
||||
"file": path,
|
||||
"results": [{
|
||||
"message": format!("{}", error),
|
||||
"message": format!("{error}"),
|
||||
}],
|
||||
})
|
||||
),
|
||||
@ -195,7 +195,7 @@ fn main() {
|
||||
Err(error) => {
|
||||
match output_format {
|
||||
OutputFormat::HumanReadable => {
|
||||
eprintln!("Error reading file {}: {}", file, error);
|
||||
eprintln!("Error reading file {file}: {error}");
|
||||
}
|
||||
|
||||
#[cfg(feature = "json-out")]
|
||||
@ -204,7 +204,7 @@ fn main() {
|
||||
json!({
|
||||
"file": file,
|
||||
"results": [{
|
||||
"message": format!("{}", error),
|
||||
"message": format!("{error}"),
|
||||
}],
|
||||
})
|
||||
),
|
||||
@ -220,7 +220,7 @@ fn main() {
|
||||
match output_format {
|
||||
OutputFormat::HumanReadable => {
|
||||
for error in errors {
|
||||
eprintln!("Error parsing file {}: {}", file, error);
|
||||
eprintln!("Error parsing file {file}: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,9 +229,9 @@ fn main() {
|
||||
"{}",
|
||||
json!({
|
||||
"file": file,
|
||||
"results": errors.into_iter()
|
||||
"results": errors.iter()
|
||||
.map(|error| json!({
|
||||
"message": format!("{}", error),
|
||||
"message": format!("{error}"),
|
||||
}))
|
||||
.collect::<Vec<_>>(),
|
||||
})
|
||||
|
@ -45,7 +45,7 @@ pub fn print(file: String, content: &str, results: &[DeadCode]) {
|
||||
|
||||
// add report label
|
||||
let mut label = Label::new((file.clone(), start_char..end_char))
|
||||
.with_message(format!("{}", result))
|
||||
.with_message(format!("{result}"))
|
||||
.with_order(order as i32);
|
||||
if !no_color {
|
||||
label = label.with_color(result.scope.color());
|
||||
@ -84,12 +84,12 @@ pub fn print_json(file: &str, content: &str, results: &[DeadCode]) {
|
||||
line_offset = offset;
|
||||
}
|
||||
json!({
|
||||
"message": format!("{}", result),
|
||||
"message": format!("{result}"),
|
||||
"line": line_number,
|
||||
"column": start - line_offset + 1,
|
||||
"endColumn": usize::from(range.end()) - line_offset + 1,
|
||||
})
|
||||
}).collect::<serde_json::Value>(),
|
||||
});
|
||||
println!("{}", json);
|
||||
println!("{json}");
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ impl Scope {
|
||||
match param {
|
||||
Param::IdentParam(ident_param) => {
|
||||
let name = ident_param.ident().expect("IdentParam.ident()");
|
||||
Some(Scope::LambdaArg(name, body.clone()))
|
||||
Some(Scope::LambdaArg(name, body))
|
||||
}
|
||||
Param::Pattern(pattern) => {
|
||||
Some(Scope::LambdaPattern(pattern, body))
|
||||
|
@ -22,11 +22,7 @@ pub fn find(name: &Ident, node: &SyntaxNode<NixLanguage>) -> bool {
|
||||
}
|
||||
|
||||
let ident = if node.kind() == SyntaxKind::NODE_IDENT {
|
||||
if let Some(ident) = Ident::cast(node.clone()) {
|
||||
Some(ident)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
Ident::cast(node.clone())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user