Skip to content

Commit aa37197

Browse files
committed
Migrate to Rust 2024 edition
1 parent b49d747 commit aa37197

File tree

10 files changed

+125
-91
lines changed

10 files changed

+125
-91
lines changed

Cargo.lock

Lines changed: 64 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "gitql"
33
authors = ["AmrDeveloper"]
44
version = "0.40.0"
5-
edition = "2021"
5+
edition = "2024"
66
description = "A SQL like query language to perform queries on .git files"
77
license = "MIT"
88
repository = "https://github.com/amrdeveloper/gql/"
@@ -25,18 +25,18 @@ members = [
2525
[workspace.dependencies]
2626
gix = { version = "0.73.0", default-features = false }
2727
dyn-clone = { version = "1.0.20" }
28-
comfy-table = { version = "7.1.4" }
28+
comfy-table = { version = "7.2.1" }
2929
termcolor = { version = "1.4.1" }
30-
serde_json = { version = "1.0.142" }
30+
serde_json = { version = "1.0.145" }
3131
csv = { version = "1.3.1" }
3232
yaml-rust = { version = "0.4.5" }
33-
chrono = { version = "0.4.41" }
34-
regex = { version = "1.11.1" }
33+
chrono = { version = "0.4.42" }
34+
regex = { version = "1.11.3" }
3535
rand = { version = "0.9.2" }
36-
indexmap = { version = "2.10.0" }
36+
indexmap = { version = "2.11.4" }
3737
phf = { version = "0.13.1" }
3838
linked-hash-map = { version = "0.5.6" }
39-
uuid = { version = "1.17.0", features = ["v4"] }
39+
uuid = { version = "1.18.1", features = ["v4"] }
4040
gitql-core = { path = "./crates/gitql-core", version = "0.17.0" }
4141
gitql-std = { path = "./crates/gitql-std", version = "0.17.0" }
4242
gitql-ast = { path = "./crates/gitql-ast", version = "0.36.0" }

benches/benchmarks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::hint::black_box;
22

3+
use criterion::Criterion;
34
use criterion::criterion_group;
45
use criterion::criterion_main;
5-
use criterion::Criterion;
66
use gitql_parser::tokenizer::Tokenizer;
77

88
const QUERY_100_CHAR: &str = "SELECT name, COUNT(name) FROM commits GROUP BY name, author_email ORDER BY commit_num DESC LIMIT 100";

src/gitql/functions/commits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::collections::HashMap;
33
use gitql_ast::types::text::TextType;
44
use gitql_core::signature::Signature;
55
use gitql_core::signature::StandardFunction;
6-
use gitql_core::values::text::TextValue;
76
use gitql_core::values::Value;
7+
use gitql_core::values::text::TextValue;
88

99
#[inline(always)]
1010
pub(crate) fn register_commits_functions(map: &mut HashMap<&'static str, StandardFunction>) {

src/gitql/functions/diffs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use gitql_ast::types::integer::IntType;
77
use gitql_ast::types::text::TextType;
88
use gitql_core::signature::Signature;
99
use gitql_core::signature::StandardFunction;
10+
use gitql_core::values::Value;
1011
use gitql_core::values::array::ArrayValue;
1112
use gitql_core::values::boolean::BoolValue;
1213
use gitql_core::values::integer::IntValue;
1314
use gitql_core::values::text::TextValue;
14-
use gitql_core::values::Value;
1515

1616
use crate::gitql::types::diff_changes::DiffChangesType;
1717
use crate::gitql::values::diff_changes::DiffChangeKind;

src/gitql/gitql_data_provider.rs

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use std::convert::Infallible;
22

33
use gitql_core::object::Row;
4+
use gitql_core::values::Value;
45
use gitql_core::values::boolean::BoolValue;
56
use gitql_core::values::datetime::DateTimeValue;
67
use gitql_core::values::integer::IntValue;
78
use gitql_core::values::null::NullValue;
89
use gitql_core::values::text::TextValue;
9-
use gitql_core::values::Value;
1010
use gitql_engine::data_provider::DataProvider;
1111

1212
use gix::diff::blob::pipeline::Mode;
@@ -227,11 +227,11 @@ fn select_branches(
227227
}
228228

229229
if column_name == "commit_count" {
230-
if let Some(id) = branch.try_id() {
231-
if let Ok(walker) = id.ancestors().all() {
232-
values.push(Box::new(IntValue::new(walker.count() as i64)));
233-
continue;
234-
}
230+
if let Some(id) = branch.try_id()
231+
&& let Ok(walker) = id.ancestors().all()
232+
{
233+
values.push(Box::new(IntValue::new(walker.count() as i64)));
234+
continue;
235235
}
236236
values.push(Box::new(IntValue::new_zero()));
237237
continue;
@@ -316,31 +316,30 @@ fn select_diffs(repo: &gix::Repository, selected_columns: &[String]) -> Result<V
316316
let (mut insertions, mut removals, mut files_changed) = (0, 0, 0);
317317
let mut diff_changes: Vec<DiffChange> = vec![];
318318

319-
if should_calculate_diffs {
320-
if let Some(parent) = commit_info
319+
if should_calculate_diffs
320+
&& let Some(parent) = commit_info
321321
.parent_ids()
322322
.next()
323323
.map(|id| id.object().unwrap().into_commit().tree().unwrap())
324-
{
325-
let current = commit.tree().unwrap();
326-
rewrite_cache.clear_resource_cache_keep_allocation();
327-
diff_cache.clear_resource_cache_keep_allocation();
328-
329-
if let Ok(mut changes) = current.changes() {
330-
let _ = changes.for_each_to_obtain_tree_with_cache(
331-
&parent,
332-
&mut rewrite_cache,
333-
|change| {
334-
files_changed += usize::from(change.entry_mode().is_no_tree());
335-
let diff_change =
336-
DiffChange::new_with_content(&change, &mut diff_cache, &repo);
337-
insertions += diff_change.insertions;
338-
removals += diff_change.removals;
339-
diff_changes.push(diff_change);
340-
Ok::<_, Infallible>(Default::default())
341-
},
342-
);
343-
}
324+
{
325+
let current = commit.tree().unwrap();
326+
rewrite_cache.clear_resource_cache_keep_allocation();
327+
diff_cache.clear_resource_cache_keep_allocation();
328+
329+
if let Ok(mut changes) = current.changes() {
330+
let _ = changes.for_each_to_obtain_tree_with_cache(
331+
&parent,
332+
&mut rewrite_cache,
333+
|change| {
334+
files_changed += usize::from(change.entry_mode().is_no_tree());
335+
let diff_change =
336+
DiffChange::new_with_content(&change, &mut diff_cache, &repo);
337+
insertions += diff_change.insertions;
338+
removals += diff_change.removals;
339+
diff_changes.push(diff_change);
340+
Ok::<_, Infallible>(Default::default())
341+
},
342+
);
344343
}
345344
}
346345

src/gitql/gitql_line_editor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
use lineeditor::event::LineEditorEvent;
2-
use lineeditor::keybindings::KeyCombination;
3-
use lineeditor::style::Style;
4-
use lineeditor::styled_buffer::StyledBuffer;
51
use lineeditor::Color;
62
use lineeditor::Completer;
73
use lineeditor::Highlighter;
@@ -11,6 +7,10 @@ use lineeditor::LineEditor;
117
use lineeditor::Span;
128
use lineeditor::StringPrompt;
139
use lineeditor::Suggestion;
10+
use lineeditor::event::LineEditorEvent;
11+
use lineeditor::keybindings::KeyCombination;
12+
use lineeditor::style::Style;
13+
use lineeditor::styled_buffer::StyledBuffer;
1414

1515
const GITQL_RESERVED_KEYWORDS: [&str; 57] = [
1616
"do",

0 commit comments

Comments
 (0)