Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit eafdf74

Browse files
authored
Merge pull request #12 from mkmik/moreclean
Controversial lifetime simplifications
2 parents 141a446 + a89fd26 commit eafdf74

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/jsonpath.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ impl std::fmt::Display for SyntaxError {
1818
}
1919
}
2020

21-
pub fn parse<'a>(selector: &'a str) -> Result<Box<dyn Path + 'a>, SyntaxError> {
21+
pub fn parse(selector: &str) -> Result<Box<dyn Path + '_>, SyntaxError> {
2222
parser::parse(selector).map_err(|m| SyntaxError { message: m })
2323
}

src/matchers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub trait Matcher {
2323
pub struct RootSelector {}
2424

2525
impl Matcher for RootSelector {
26-
fn select<'a>(&'a self, node: &'a Value) -> Iter<'a> {
26+
fn select<'a>(&self, node: &'a Value) -> Iter<'a> {
2727
Box::new(iter::once(node))
2828
}
2929
}
@@ -53,7 +53,7 @@ impl Child {
5353
}
5454

5555
impl Matcher for Child {
56-
fn select<'a>(&'a self, node: &'a Value) -> Iter<'a> {
56+
fn select<'a>(&self, node: &'a Value) -> Iter<'a> {
5757
Box::new(node.get(&self.name).into_iter())
5858
}
5959
}

src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::pest::Parser;
1212
#[grammar = "grammar.pest"]
1313
struct PathParser;
1414

15-
pub fn parse<'a>(selector: &'a str) -> Result<Box<dyn path::Path + 'a>, String> {
15+
pub fn parse(selector: &str) -> Result<Box<dyn path::Path + '_>, String> {
1616
let selector_rule = PathParser::parse(Rule::selector, selector)
1717
.map_err(|e| format!("{}", e))?
1818
.next()

src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct SelectorPath {
1919
matchers: Vec<Box<dyn matchers::Matcher>>,
2020
}
2121

22-
pub fn new<'a>(matchers: Vec<Box<dyn matchers::Matcher>>) -> impl Path + 'a {
22+
pub fn new(matchers: Vec<Box<dyn matchers::Matcher>>) -> impl Path {
2323
SelectorPath { matchers }
2424
}
2525

0 commit comments

Comments
 (0)