Skip to content

Commit 8910896

Browse files
committed
[function-grep] Bumped tree sitter version
Also a little bit of listening to clippy
1 parent 6380838 commit 8910896

File tree

9 files changed

+27
-30
lines changed

9 files changed

+27
-30
lines changed

cargo-function-history/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ rust-version = "1.76.0"
1414
[features]
1515
default = ["parallel"]
1616
parallel = ["git_function_history/parallel", "function_history_backend_thread/parallel"]
17-
# c_lang = ["function_history_backend_thread/c_lang", "git_function_history/c_lang"]
1817

1918
[dependencies]
2019
git_function_history = { path = "../git-function-history-lib", version = "0.7.1", default-features = false}

function-grep/Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ go = ["dep:tree-sitter-go"]
2323
c-sharp = ["dep:tree-sitter-c-sharp"]
2424

2525
[dependencies]
26-
tree-sitter = ">=0.21.0"
27-
tree-sitter-c = { version = "0.21.4", optional = true }
28-
tree-sitter-java = { version = "0.21.0", optional = true }
29-
tree-sitter-ocaml = { version = "0.21.2", optional = true }
30-
tree-sitter-python = { version = "0.21.0", optional = true }
31-
tree-sitter-ruby = { version = "0.21.0", optional = true }
32-
tree-sitter-go = { version = "0.21.2", optional = true }
33-
tree-sitter-c-sharp = { version = "0.21.3", optional = true }
34-
tree-sitter-rust = { version = "0.21.2", optional = true }
35-
tree-sitter-tags = "0.21"
26+
tree-sitter = ">=0.23.0"
27+
tree-sitter-c = { version = "0.23.0", optional = true }
28+
tree-sitter-java = { version = "0.23.2", optional = true }
29+
tree-sitter-ocaml = { version = "0.23.0", optional = true }
30+
tree-sitter-python = { version = "0.23.2", optional = true }
31+
tree-sitter-ruby = { version = "0.23.0", optional = true }
32+
tree-sitter-go = { version = "0.23.1", optional = true }
33+
tree-sitter-c-sharp = { version = "0.23.0", optional = true }
34+
tree-sitter-rust = { version = "0.23.0", optional = true }
35+
tree-sitter-tags = "0.23"
3636

3737
[dev-dependencies]
38-
clap = { version = "4.5.7", features = ["derive"] }
38+
clap = { version = "4.5.16", features = ["derive"] }
3939

4040
[[example]]
4141
name = "function-grep"

function-grep/src/filter/filter_parsers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
pub(crate) fn number<'a>(
1+
pub fn number<'a>(
22
substring: &mut impl Iterator<Item = &'a str>,
33
format: &str,
44
position: &str,
55
) -> Result<usize, String> {
66
substring.next().ok_or_else(||format! ("invalid options for function_in_lines filter\nexpected {format}\n missing {position} [number]"))
77
.and_then(|end| end.parse().map_err(|_| format! ("invalid options for function_in_lines filter\nexpected {format}\n cannot parse {position} [number]")))
88
}
9-
pub(crate) fn extra<'a>(
9+
pub fn extra<'a>(
1010
substring: &mut impl Iterator<Item = &'a str>,
1111
format: &str,
1212
) -> Result<(), String> {
1313
substring.next().map_or(Ok(()), |extra| Err(format!( "invalid options for function_in_lines filter\nexpected {format}\n, found extra stuff after {format}: {extra}")))
1414
}
15-
pub(crate) fn label<'a>(
15+
pub fn label<'a>(
1616
substring: &mut impl Iterator<Item = &'a str>,
1717
format: &str,
1818
label: &str,

function-grep/src/filter/general_filters.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use tree_sitter::Node;
55
use crate::SupportedLanguages;
66

77
use super::{
8-
filter_parsers::*, Attribute, AttributeType, Filter, FilterFunction, HasFilterInformation,
8+
filter_parsers::{extra, label, number},
9+
Attribute, AttributeType, Filter, FilterFunction, HasFilterInformation,
910
};
1011

1112
pub struct FunctionInLines;

function-grep/src/supported_languages.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ macro_rules! construct_language {
235235
}
236236

237237
fn language(&self) -> TsLanguage {
238-
$tslang
238+
$tslang.into()
239239
}
240240
}
241241
impl Assoc for $name {
@@ -266,7 +266,7 @@ macro_rules! construct_language {
266266
}
267267

268268
fn language(&self) -> TsLanguage {
269-
$tslang
269+
$tslang.into()
270270
}
271271
}
272272
impl Assoc for $name {
@@ -282,7 +282,7 @@ macro_rules! construct_language {
282282

283283
#[cfg(feature = "c")]
284284

285-
construct_language!(C(tree_sitter_c::language()).[c h]?=
285+
construct_language!(C(tree_sitter_c::LANGUAGE).[c h]?=
286286
name -> "((function_definition
287287
declarator:
288288
(function_declarator declarator: (identifier) @method-name))
@@ -296,12 +296,12 @@ construct_language!(C(tree_sitter_c::language()).[c h]?=
296296

297297
#[cfg(feature = "ruby")]
298298
// TODO: also query for anonymous functions assigned to variables
299-
construct_language!(Ruby(tree_sitter_ruby::language()).[rb] ?= "method-name" =>
299+
construct_language!(Ruby(tree_sitter_ruby::LANGUAGE).[rb] ?= "method-name" =>
300300
"((method name: (identifier) @method-name) @method-definition)");
301301

302302
#[cfg(feature = "c-sharp")]
303303
// TODO: also query for anonymous functions assigned to variables
304-
construct_language!(CSharp(tree_sitter_c_sharp::language()).[cs] ?= "method-name" =>
304+
construct_language!(CSharp(tree_sitter_c_sharp::LANGUAGE).[cs] ?= "method-name" =>
305305
"((local_function_statement name: (identifier) @method-name) @method)
306306
((method_declaration name: (identifier) @method-name) @method)"
307307

@@ -327,10 +327,10 @@ construct_language!(CSharp(tree_sitter_c_sharp::language()).[cs] ?= "method-name
327327
// ((var_declaration (var_spec name: (identifier) @method-name )))
328328
// ((const_declaration))
329329
// ((short_var_declaration))
330-
construct_language!(Go(tree_sitter_go::language()).[go] ?= "method-name" =>
330+
construct_language!(Go(tree_sitter_go::LANGUAGE).[go] ?= "method-name" =>
331331
"((function_declaration name: (identifier) @method-name) @method-definition)");
332332
#[cfg(feature = "rust")]
333-
construct_language!(Rust(tree_sitter_rust::language()).[rs] ?= "method-name" =>
333+
construct_language!(Rust(tree_sitter_rust::LANGUAGE).[rs] ?= "method-name" =>
334334

335335
"((function_item
336336
name: (identifier) @method-name)
@@ -351,7 +351,7 @@ construct_language!(Rust(tree_sitter_rust::language()).[rs] ?= "method-name" =>
351351
);
352352

353353
#[cfg(feature = "python")]
354-
construct_language!(Python(tree_sitter_python::language()).[py]?= "method-name" =>
354+
construct_language!(Python(tree_sitter_python::LANGUAGE).[py]?= "method-name" =>
355355

356356
"((function_definition
357357
name: (identifier) @method-name)
@@ -365,7 +365,7 @@ construct_language!(Python(tree_sitter_python::language()).[py]?= "method-name"
365365
);
366366

367367
#[cfg(feature = "java")]
368-
construct_language!(Java(tree_sitter_java::language()).[java]?="method-name" =>
368+
construct_language!(Java(tree_sitter_java::LANGUAGE).[java]?="method-name" =>
369369
"((method_declaration
370370
name: (identifier) @method-name)
371371
@method-definition

function_history_backend_thread/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ rust-version = "1.76.0"
1515
[features]
1616
default = ["parallel"]
1717
parallel = ["git_function_history/parallel"]
18-
# c_lang = ["git_function_history/c_lang"]
1918

2019
[dependencies]
2120
git_function_history = { path = "../git-function-history-lib", version = "0.7.1", default-features = false}

git-function-history-gui/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ rust-version = "1.79.0"
1414
[features]
1515
default = ["parallel"]
1616
parallel = ["git_function_history/parallel", "function_history_backend_thread/parallel"]
17-
# c_lang = ["git_function_history/c_lang", "function_history_backend_thread/c_lang"]
1817

1918
[dependencies]
2019
eframe = {version = "0.28.1"}

git-function-history-lib/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ chrono = "0.4.38"
2424
rayon = { version = "1.10.0", optional = true }
2525
cfg-if = "1.0.0"
2626
cached = { version = "0.53.1", optional = true }
27-
# git-index-performanc
2827
gix = { version = "0.66.0", default-features = false, features = [
2928
"max-performance-safe",
3029
"revision",

git-function-history-lib/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn traverse_tree(
338338
langs: &[&InstatiatedLanguage<'_>],
339339
filetype: &FileFilterType,
340340
) -> Result<Vec<ParsedFile>, String> {
341-
let mut files_exts_iter = file_exts.iter();
341+
let files_exts_iter = file_exts.iter();
342342
let treee_iter = tree.iter();
343343
let mut files: Vec<_> = Vec::new();
344344
let mut ret = Vec::new();
@@ -581,7 +581,7 @@ mod tests {
581581
match &output {
582582
Ok(functions) => {
583583
println!("{functions}");
584-
println!("{:?}", functions.get_metadata())
584+
println!("{:?}", functions.get_metadata());
585585
}
586586
Err(e) => println!("{e}"),
587587
}

0 commit comments

Comments
 (0)