Skip to content

Commit d738f8f

Browse files
committed
Migrate to Rust 1.88.0
1 parent 0dcc9f1 commit d738f8f

File tree

18 files changed

+86
-148
lines changed

18 files changed

+86
-148
lines changed

crates/gitql-ast/src/interval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Display for Interval {
111111

112112
let (hours, minutes, seconds) = (self.hours, self.minutes, self.seconds);
113113
if hours != 0 || minutes != 0 || seconds != 0f64 {
114-
parts.push(format!("{:02}:{:02}:{:02}", hours, minutes, seconds));
114+
parts.push(format!("{hours:02}:{minutes:02}:{seconds:02}"));
115115
}
116116

117117
if parts.is_empty() {
@@ -127,7 +127,7 @@ fn interval_value_or_error_i64(value: i64) -> Result<i64, String> {
127127
if (-INTERVAL_MAX_VALUE_I..=INTERVAL_MAX_VALUE_I).contains(&value) {
128128
return Ok(value);
129129
}
130-
Err(format!("Interval value out of range {}", value))
130+
Err(format!("Interval value out of range {value}"))
131131
}
132132

133133
fn interval_value_or_error_f64(value: f64) -> Result<f64, String> {

crates/gitql-cli/src/arguments.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ pub fn parse_arguments(args: &[String]) -> Command {
5858

5959
let arg = &args[arg_index];
6060
if !arg.starts_with('-') {
61-
return Command::Error(format!("Unknown argument {}", arg));
61+
return Command::Error(format!("Unknown argument {arg}"));
6262
}
6363

6464
match arg.as_ref() {
6565
"--repos" | "-r" => {
6666
arg_index += 1;
6767
if arg_index >= args_len {
68-
let message = format!("Argument {} must be followed by one or more path", arg);
68+
let message = format!("Argument {arg} must be followed by one or more path");
6969
return Command::Error(message);
7070
}
7171

@@ -87,7 +87,7 @@ pub fn parse_arguments(args: &[String]) -> Command {
8787
"--query" | "-q" => {
8888
arg_index += 1;
8989
if arg_index >= args_len {
90-
let message = format!("Argument {} must be followed by the query", arg);
90+
let message = format!("Argument {arg} must be followed by the query");
9191
return Command::Error(message);
9292
}
9393

@@ -97,7 +97,7 @@ pub fn parse_arguments(args: &[String]) -> Command {
9797
"--script" | "-s" => {
9898
arg_index += 1;
9999
if arg_index >= args_len {
100-
let message = format!("Argument {} must be followed by the file", arg);
100+
let message = format!("Argument {arg} must be followed by the file");
101101
return Command::Error(message);
102102
}
103103

@@ -115,7 +115,7 @@ pub fn parse_arguments(args: &[String]) -> Command {
115115
"--pagesize" | "-ps" => {
116116
arg_index += 1;
117117
if arg_index >= args_len {
118-
let message = format!("Argument {} must be followed by the page size", arg);
118+
let message = format!("Argument {arg} must be followed by the page size");
119119
return Command::Error(message);
120120
}
121121

@@ -135,7 +135,7 @@ pub fn parse_arguments(args: &[String]) -> Command {
135135
"--output" | "-o" => {
136136
arg_index += 1;
137137
if arg_index >= args_len {
138-
let message = format!("Argument {} must be followed by output format", arg);
138+
let message = format!("Argument {arg} must be followed by output format");
139139
return Command::Error(message);
140140
}
141141

@@ -154,7 +154,7 @@ pub fn parse_arguments(args: &[String]) -> Command {
154154

155155
arg_index += 1;
156156
}
157-
_ => return Command::Error(format!("Unknown command {}", arg)),
157+
_ => return Command::Error(format!("Unknown command {arg}")),
158158
}
159159
}
160160

crates/gitql-cli/src/diagnostic_reporter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ impl DiagnosticReporter {
4747

4848
self.stdout.set_color(Some(Color::Cyan));
4949
for help in diagnostic.helps() {
50-
println!(" = Help: {}", help);
50+
println!(" = Help: {help}");
5151
}
5252

5353
self.stdout.set_color(Some(Color::Yellow));
5454
for note in diagnostic.notes() {
55-
println!(" = Note: {}", note);
55+
println!(" = Note: {note}");
5656
}
5757

5858
self.stdout.set_color(Some(Color::Blue));
5959
if let Some(docs) = diagnostic.docs() {
60-
println!(" = Docs: {}", docs);
60+
println!(" = Docs: {docs}");
6161
}
6262

6363
self.stdout.reset();

crates/gitql-cli/src/printer/csv_printer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ impl BaseOutputPrinter for CSVPrinter {
2525

2626
if let Ok(writer_content) = writer.into_inner() {
2727
if let Ok(content) = String::from_utf8(writer_content) {
28-
if let Err(error) = writeln!(stdout(), "{}", content) {
29-
eprintln!("{}", error);
28+
if let Err(error) = writeln!(stdout(), "{content}") {
29+
eprintln!("{error}");
3030
std::process::exit(1);
3131
}
3232
}

crates/gitql-cli/src/printer/json_printer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ impl BaseOutputPrinter for JSONPrinter {
2626
}
2727

2828
if let Ok(json_str) = serde_json::to_string(&serde_json::Value::Array(elements)) {
29-
if let Err(error) = writeln!(stdout(), "{}", json_str) {
30-
eprintln!("{}", error);
29+
if let Err(error) = writeln!(stdout(), "{json_str}") {
30+
eprintln!("{error}");
3131
std::process::exit(1);
3232
}
3333
}

crates/gitql-cli/src/printer/table_printer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl BaseOutputPrinter for TablePrinter {
8787
let end_index = (start_index + self.page_size).min(group_len);
8888

8989
let current_page_groups = &group.rows[start_index..end_index];
90-
println!("Page {}/{}", current_page, number_of_pages);
90+
println!("Page {current_page}/{number_of_pages}");
9191
self.print_group_as_table(titles, table_headers.clone(), current_page_groups);
9292

9393
let pagination_input = self.handle_pagination_input(current_page, number_of_pages);

crates/gitql-cli/src/printer/yaml_printer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ impl BaseOutputPrinter for YAMLPrinter {
3333
}
3434

3535
if let Err(error) = emitter.dump(&Yaml::Array(rows_rows)) {
36-
eprintln!("{}", error);
36+
eprintln!("{error}");
3737
std::process::exit(1);
3838
}
3939

40-
if let Err(error) = writeln!(stdout(), "{}", out_str) {
41-
eprintln!("{}", error);
40+
if let Err(error) = writeln!(stdout(), "{out_str}") {
41+
eprintln!("{error}");
4242
std::process::exit(1);
4343
}
4444
}

crates/gitql-engine/src/engine_evaluator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ fn evaluate_global_variable(
258258
}
259259

260260
Err(format!(
261-
"The value of `{}` may be not exists or calculated yet",
262-
name
261+
"The value of `{name}` may be not exists or calculated yet",
263262
))
264263
}
265264

crates/gitql-parser/src/parse_comparisons.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ pub(crate) fn parse_comparison_expression(
128128
}
129129

130130
let mut diagnostic = Diagnostic::error(&format!(
131-
"Operator `=` can't be performed between types `{}` and `{}`",
132-
lhs_type, rhs_type
131+
"Operator `=` can't be performed between types `{lhs_type}` and `{rhs_type}`",
133132
))
134133
.with_location(operator.location);
135134

@@ -208,8 +207,7 @@ pub(crate) fn parse_comparison_expression(
208207
}
209208

210209
let mut diagnostic = Diagnostic::error(&format!(
211-
"Operator `!=` can't be performed between types `{}` and `{}`",
212-
lhs_type, rhs_type
210+
"Operator `!=` can't be performed between types `{lhs_type}` and `{rhs_type}`",
213211
))
214212
.with_location(operator.location);
215213

@@ -290,8 +288,7 @@ pub(crate) fn parse_comparison_expression(
290288

291289
// Return error if this operator can't be performed even with implicit cast
292290
return Err(Diagnostic::error(&format!(
293-
"Operator `>` can't be performed between types `{}` and `{}`",
294-
lhs_type, rhs_type
291+
"Operator `>` can't be performed between types `{lhs_type}` and `{rhs_type}`",
295292
))
296293
.with_location(operator.location)
297294
.as_boxed());
@@ -363,8 +360,7 @@ pub(crate) fn parse_comparison_expression(
363360

364361
// Return error if this operator can't be performed even with implicit cast
365362
return Err(Diagnostic::error(&format!(
366-
"Operator `>=` can't be performed between types `{}` and `{}`",
367-
lhs_type, rhs_type
363+
"Operator `>=` can't be performed between types `{lhs_type}` and `{rhs_type}`",
368364
))
369365
.with_location(operator.location)
370366
.as_boxed());
@@ -436,8 +432,7 @@ pub(crate) fn parse_comparison_expression(
436432

437433
// Return error if this operator can't be performed even with implicit cast
438434
return Err(Diagnostic::error(&format!(
439-
"Operator `<` can't be performed between types `{}` and `{}`",
440-
lhs_type, rhs_type
435+
"Operator `<` can't be performed between types `{lhs_type}` and `{rhs_type}`",
441436
))
442437
.with_location(operator.location)
443438
.as_boxed());
@@ -509,8 +504,7 @@ pub(crate) fn parse_comparison_expression(
509504

510505
// Return error if this operator can't be performed even with implicit cast
511506
return Err(Diagnostic::error(&format!(
512-
"Operator `<=` can't be performed between types `{}` and `{}`",
513-
lhs_type, rhs_type
507+
"Operator `<=` can't be performed between types `{lhs_type}` and `{rhs_type}`",
514508
))
515509
.with_location(operator.location)
516510
.as_boxed());
@@ -582,8 +576,7 @@ pub(crate) fn parse_comparison_expression(
582576

583577
// Return error if this operator can't be performed even with implicit cast
584578
return Err(Diagnostic::error(&format!(
585-
"Operator `<=>` can't be performed between types `{}` and `{}`",
586-
lhs_type, rhs_type
579+
"Operator `<=>` can't be performed between types `{lhs_type}` and `{rhs_type}`",
587580
))
588581
.with_location(operator.location)
589582
.as_boxed());

crates/gitql-parser/src/parse_function_call.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ pub(crate) fn parse_function_call_expression(
8080

8181
// Function has no signature registered on the signature table
8282
return Err(Diagnostic::error(&format!(
83-
"Can't find signature for function with name {}",
84-
function_name
83+
"Can't find signature for function with name {function_name}",
8584
))
8685
.with_location(function_name_location)
8786
.as_boxed());
@@ -164,8 +163,7 @@ pub(crate) fn parse_function_call_expression(
164163

165164
// Aggregation Function has no signature registered on the signature table
166165
return Err(Diagnostic::error(&format!(
167-
"Can't find signature for Aggregation function with name {}",
168-
function_name
166+
"Can't find signature for Aggregation function with name {function_name}",
169167
))
170168
.with_location(function_name_location)
171169
.as_boxed());
@@ -272,8 +270,7 @@ pub(crate) fn parse_function_call_expression(
272270

273271
// Aggregation Function has no signature registered on the signature table
274272
return Err(Diagnostic::error(&format!(
275-
"Can't find signature for Window function with name {}",
276-
function_name
273+
"Can't find signature for Window function with name {function_name}",
277274
))
278275
.with_location(function_name_location)
279276
.as_boxed());
@@ -282,8 +279,7 @@ pub(crate) fn parse_function_call_expression(
282279
// Report that this function name is not standard or aggregation
283280
return Err(Diagnostic::error("No such function name")
284281
.add_help(&format!(
285-
"Function `{}` is not an Aggregation or Standard library function name",
286-
function_name,
282+
"Function `{function_name}` is not an Aggregation or Standard library function name",
287283
))
288284
.with_location(function_name_location)
289285
.as_boxed());

0 commit comments

Comments
 (0)