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

Controversial lifetime simplifications #12

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jsonpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ impl std::fmt::Display for SyntaxError {
}
}

pub fn parse<'a>(selector: &'a str) -> Result<Box<dyn Path + 'a>, SyntaxError> {
pub fn parse(selector: &str) -> Result<Box<dyn Path + '_>, SyntaxError> {
parser::parse(selector).map_err(|m| SyntaxError { message: m })
}
4 changes: 2 additions & 2 deletions src/matchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub trait Matcher {
pub struct RootSelector {}

impl Matcher for RootSelector {
fn select<'a>(&'a self, node: &'a Value) -> Iter<'a> {
fn select<'a>(&self, node: &'a Value) -> Iter<'a> {
Box::new(iter::once(node))
}
}
Expand Down Expand Up @@ -53,7 +53,7 @@ impl Child {
}

impl Matcher for Child {
fn select<'a>(&'a self, node: &'a Value) -> Iter<'a> {
fn select<'a>(&self, node: &'a Value) -> Iter<'a> {
Box::new(node.get(&self.name).into_iter())
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::pest::Parser;
#[grammar = "grammar.pest"]
struct PathParser;

pub fn parse<'a>(selector: &'a str) -> Result<Box<dyn path::Path + 'a>, String> {
pub fn parse(selector: &str) -> Result<Box<dyn path::Path + '_>, String> {
let selector_rule = PathParser::parse(Rule::selector, selector)
.map_err(|e| format!("{}", e))?
.next()
Expand Down
2 changes: 1 addition & 1 deletion src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct SelectorPath {
matchers: Vec<Box<dyn matchers::Matcher>>,
}

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

Expand Down