Skip to content

Commit 9bca2fc

Browse files
committed
chore: apply clippy suggestions
1 parent 5f83af2 commit 9bca2fc

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

src/bin/make_release.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn main() {
6363
println!("\nNew version will be: {}", new_version);
6464

6565
let tag_exists = Command::new("git")
66-
.args(&["rev-parse", &new_version])
66+
.args(["rev-parse", &new_version])
6767
.output()
6868
.map(|output| output.status.success())
6969
.unwrap_or(false);
@@ -96,7 +96,7 @@ fn main() {
9696

9797
println!("\nRunning cargo build...");
9898
let build_status = Command::new("cargo")
99-
.args(&["build", "--release"])
99+
.args(["build", "--release"])
100100
.status()
101101
.expect("Failed to run cargo build");
102102

@@ -108,7 +108,7 @@ fn main() {
108108

109109
println!("\nAdding files to git...");
110110
let add_status = Command::new("git")
111-
.args(&["add", "Cargo.toml", "Cargo.lock"])
111+
.args(["add", "Cargo.toml", "Cargo.lock"])
112112
.status()
113113
.expect("Failed to run git add");
114114

@@ -119,7 +119,7 @@ fn main() {
119119

120120
let commit_msg = format!("Update to version {}", new_version);
121121
let commit_status = Command::new("git")
122-
.args(&["commit", "-m", &commit_msg])
122+
.args(["commit", "-m", &commit_msg])
123123
.status()
124124
.expect("Failed to run git commit");
125125

@@ -130,7 +130,7 @@ fn main() {
130130
println!("✓ Committed changes");
131131

132132
let tag_status = Command::new("git")
133-
.args(&["tag", &new_version])
133+
.args(["tag", &new_version])
134134
.status()
135135
.expect("Failed to run git tag");
136136

@@ -142,7 +142,7 @@ fn main() {
142142

143143
println!("\nGenerating changelog...");
144144
let shortlog_output = Command::new("git")
145-
.args(&["shortlog", &format!("{}..HEAD", current_version)])
145+
.args(["shortlog", &format!("{}..HEAD", current_version)])
146146
.output()
147147
.expect("Failed to run git shortlog");
148148

src/formatter.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,11 @@ impl Formatter {
308308
let mut stack = vec![self.tree.root_node()];
309309

310310
while let Some(node) = stack.pop() {
311-
if node.kind() == "lambda" {
312-
if let Some(body) = node.child_by_field_name("body") {
313-
if body.end_position().row > node.start_position().row {
311+
if node.kind() == "lambda"
312+
&& let Some(body) = node.child_by_field_name("body")
313+
&& body.end_position().row > node.start_position().row {
314314
captures.push((node, body));
315315
}
316-
}
317-
}
318316

319317
let mut cursor = node.walk();
320318
for child in node.children(&mut cursor) {
@@ -341,9 +339,9 @@ impl Formatter {
341339
let mut closing_merges: Vec<(usize, usize)> = Vec::new();
342340

343341
for (lambda, body) in captures {
344-
let header_row = lambda.start_position().row as usize;
345-
let mut first_row = body.start_position().row as usize;
346-
let last_row = body.end_position().row as usize;
342+
let header_row = lambda.start_position().row;
343+
let mut first_row = body.start_position().row;
344+
let last_row = body.end_position().row;
347345

348346
if first_row == header_row {
349347
first_row = first_row.saturating_add(1);
@@ -740,7 +738,7 @@ fn parse_top_level_token_signatures(
740738
.unwrap();
741739
let tree = parser
742740
.parse(source, None)
743-
.ok_or_else(|| "Failed to parse GDScript source in safe mode")?;
741+
.ok_or("Failed to parse GDScript source in safe mode")?;
744742

745743
top_level_token_signatures_from_tree(&tree, source)
746744
}

src/reorder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ fn extract_tokens_to_reorder(
366366
if let Some(last_element) = elements.last_mut() {
367367
let last_end = last_element.end_byte;
368368
let comment_start = node.start_byte();
369-
if last_end <= comment_start && comment_start <= content.len() {
370-
if let Some(spacing) = content.get(last_end..comment_start) {
369+
if last_end <= comment_start && comment_start <= content.len()
370+
&& let Some(spacing) = content.get(last_end..comment_start) {
371371
let has_newline = spacing.contains('\n') || spacing.contains('\r');
372372
if !has_newline {
373373
last_element.original_text.push_str(spacing);
@@ -376,7 +376,6 @@ fn extract_tokens_to_reorder(
376376
handled_inline = true;
377377
}
378378
}
379-
}
380379
}
381380

382381
if !handled_inline {

0 commit comments

Comments
 (0)