From f7ea18e9d01f3d7ad35997e7b2324ddca50fd96a Mon Sep 17 00:00:00 2001 From: Marlon Costa Date: Mon, 19 Jan 2026 19:45:59 -0300 Subject: [PATCH 1/3] feat: Expose inner tree-sitter::Node for advanced use cases Makes the inner tree_sitter::Node field public to allow direct access to the underlying tree-sitter API for advanced use cases. Based on WalkerKnapp/rust-code-analysis@026e424 --- src/node.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node.rs b/src/node.rs index f6b98bb15..68cb7ce6c 100644 --- a/src/node.rs +++ b/src/node.rs @@ -24,8 +24,11 @@ impl Tree { } /// An `AST` node. +/// +/// The inner `tree_sitter::Node` is exposed for advanced use cases +/// where direct access to the underlying tree-sitter API is needed. #[derive(Clone, Copy, Debug)] -pub struct Node<'a>(OtherNode<'a>); +pub struct Node<'a>(pub OtherNode<'a>); impl<'a> Node<'a> { /// Checks if a node represents a syntax error or contains any syntax errors From 21d1c0aa5faf22aaf3e08f06a9d479956690a11a Mon Sep 17 00:00:00 2001 From: Marlon Costa Date: Mon, 19 Jan 2026 20:14:42 -0300 Subject: [PATCH 2/3] fix: Add explicit lifetime annotations to resolve clippy warnings Fix mismatched_lifetime_syntaxes warnings by adding explicit <'_> lifetime annotations to return types where the lifetime is elided. Files modified: - src/node.rs: get_root(), child_by_field_name() - src/traits.rs: ParserTrait::get_root() - src/parser.rs: TSParser::get_root() --- src/node.rs | 4 ++-- src/parser.rs | 2 +- src/traits.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node.rs b/src/node.rs index 68cb7ce6c..e59148378 100644 --- a/src/node.rs +++ b/src/node.rs @@ -18,7 +18,7 @@ impl Tree { Self(parser.parse(code, None).unwrap()) } - pub(crate) fn get_root(&self) -> Node { + pub(crate) fn get_root(&self) -> Node<'_> { Node(self.0.root_node()) } } @@ -111,7 +111,7 @@ impl<'a> Node<'a> { self.0.child_count() } - pub(crate) fn child_by_field_name(&self, name: &str) -> Option { + pub(crate) fn child_by_field_name(&self, name: &str) -> Option> { self.0.child_by_field_name(name).map(Node) } diff --git a/src/parser.rs b/src/parser.rs index 6973247e4..b13901fb8 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -152,7 +152,7 @@ impl< } #[inline(always)] - fn get_root(&self) -> Node { + fn get_root(&self) -> Node<'_> { self.tree.get_root() } diff --git a/src/traits.rs b/src/traits.rs index 0edb032b8..16d4ed9cb 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -61,7 +61,7 @@ pub trait ParserTrait { fn new(code: Vec, path: &Path, pr: Option>) -> Self; fn get_language(&self) -> LANG; - fn get_root(&self) -> Node; + fn get_root(&self) -> Node<'_>; fn get_code(&self) -> &[u8]; fn get_filters(&self, filters: &[String]) -> Filter; } From 22df3d6ae76992a846ed26af9f361f3a8014bf7c Mon Sep 17 00:00:00 2001 From: Marlon Costa Date: Mon, 19 Jan 2026 20:43:48 -0300 Subject: [PATCH 3/3] fix: Remove unnecessary parentheses in closure body --- src/tools.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools.rs b/src/tools.rs index 2dd1cf7d9..17d6f9869 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -250,7 +250,7 @@ pub(crate) fn remove_blank_lines(data: &mut Vec) { let count_trailing = data .iter() .rev() - .take_while(|&c| (*c == b'\n' || *c == b'\r')) + .take_while(|&c| *c == b'\n' || *c == b'\r') .count(); if count_trailing > 0 { data.truncate(data.len() - count_trailing);