Skip to content

Commit 21d1c0a

Browse files
author
Marlon Costa
committed
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()
1 parent f7ea18e commit 21d1c0a

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl Tree {
1818
Self(parser.parse(code, None).unwrap())
1919
}
2020

21-
pub(crate) fn get_root(&self) -> Node {
21+
pub(crate) fn get_root(&self) -> Node<'_> {
2222
Node(self.0.root_node())
2323
}
2424
}
@@ -111,7 +111,7 @@ impl<'a> Node<'a> {
111111
self.0.child_count()
112112
}
113113

114-
pub(crate) fn child_by_field_name(&self, name: &str) -> Option<Node> {
114+
pub(crate) fn child_by_field_name(&self, name: &str) -> Option<Node<'_>> {
115115
self.0.child_by_field_name(name).map(Node)
116116
}
117117

src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<
152152
}
153153

154154
#[inline(always)]
155-
fn get_root(&self) -> Node {
155+
fn get_root(&self) -> Node<'_> {
156156
self.tree.get_root()
157157
}
158158

src/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub trait ParserTrait {
6161

6262
fn new(code: Vec<u8>, path: &Path, pr: Option<Arc<PreprocResults>>) -> Self;
6363
fn get_language(&self) -> LANG;
64-
fn get_root(&self) -> Node;
64+
fn get_root(&self) -> Node<'_>;
6565
fn get_code(&self) -> &[u8];
6666
fn get_filters(&self, filters: &[String]) -> Filter;
6767
}

0 commit comments

Comments
 (0)