Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix clippy lints from 1.83.0 #110

Merged
merged 2 commits into from
Dec 4, 2024
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 deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ignore = [
allow = [
"MIT",
"Apache-2.0",
"Unicode-DFS-2016",
"Unicode-3.0",
#"Apache-2.0 WITH LLVM-exception",
]
# The confidence threshold for detecting a license from license text.
Expand Down
2 changes: 1 addition & 1 deletion serde_json_path/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl<'de> Deserialize<'de> for JsonPath {
{
struct JsonPathVisitor;

impl<'de> Visitor<'de> for JsonPathVisitor {
impl Visitor<'_> for JsonPathVisitor {
type Value = JsonPath;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
12 changes: 6 additions & 6 deletions serde_json_path_core/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,19 +552,19 @@ impl<'a> Iterator for Locations<'a> {
}
}

impl<'a> DoubleEndedIterator for Locations<'a> {
impl DoubleEndedIterator for Locations<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back().map(|l| l.location())
}
}

impl<'a> ExactSizeIterator for Locations<'a> {
impl ExactSizeIterator for Locations<'_> {
fn len(&self) -> usize {
self.inner.len()
}
}

impl<'a> FusedIterator for Locations<'a> {}
impl FusedIterator for Locations<'_> {}

/// An iterator over the nodes in a [`LocatedNodeList`]
///
Expand All @@ -582,19 +582,19 @@ impl<'a> Iterator for Nodes<'a> {
}
}

impl<'a> DoubleEndedIterator for Nodes<'a> {
impl DoubleEndedIterator for Nodes<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back().map(|l| l.node())
}
}

impl<'a> ExactSizeIterator for Nodes<'a> {
impl ExactSizeIterator for Nodes<'_> {
fn len(&self) -> usize {
self.inner.len()
}
}

impl<'a> FusedIterator for Nodes<'a> {}
impl FusedIterator for Nodes<'_> {}

/// Error produced when expecting no more than one node from a query
#[derive(Debug, thiserror::Error)]
Expand Down
20 changes: 10 additions & 10 deletions serde_json_path_core/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<'a> IntoIterator for NormalizedPath<'a> {
}
}

impl<'a> Display for NormalizedPath<'a> {
impl Display for NormalizedPath<'_> {
/// Format the [`NormalizedPath`] as a JSONPath string using the canonical bracket notation
/// as per the [JSONPath Specification][norm-paths]
///
Expand Down Expand Up @@ -200,7 +200,7 @@ impl<'a> Display for NormalizedPath<'a> {
}
}

impl<'a> Serialize for NormalizedPath<'a> {
impl Serialize for NormalizedPath<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand All @@ -218,7 +218,7 @@ pub enum PathElement<'a> {
Index(usize),
}

impl<'a> PathElement<'a> {
impl PathElement<'_> {
fn to_json_pointer(&self) -> String {
match self {
PathElement::Name(s) => s.replace('~', "~0").replace('/', "~1"),
Expand Down Expand Up @@ -253,7 +253,7 @@ impl<'a> PathElement<'a> {
}
}

impl<'a> PartialOrd for PathElement<'a> {
impl PartialOrd for PathElement<'_> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match (self, other) {
(PathElement::Name(a), PathElement::Name(b)) => a.partial_cmp(b),
Expand All @@ -263,7 +263,7 @@ impl<'a> PartialOrd for PathElement<'a> {
}
}

impl<'a> PartialEq<str> for PathElement<'a> {
impl PartialEq<str> for PathElement<'_> {
fn eq(&self, other: &str) -> bool {
match self {
PathElement::Name(s) => s.eq(&other),
Expand All @@ -272,7 +272,7 @@ impl<'a> PartialEq<str> for PathElement<'a> {
}
}

impl<'a> PartialEq<&str> for PathElement<'a> {
impl PartialEq<&str> for PathElement<'_> {
fn eq(&self, other: &&str) -> bool {
match self {
PathElement::Name(s) => s.eq(other),
Expand All @@ -281,7 +281,7 @@ impl<'a> PartialEq<&str> for PathElement<'a> {
}
}

impl<'a> PartialEq<usize> for PathElement<'a> {
impl PartialEq<usize> for PathElement<'_> {
fn eq(&self, other: &usize) -> bool {
match self {
PathElement::Name(_) => false,
Expand All @@ -290,7 +290,7 @@ impl<'a> PartialEq<usize> for PathElement<'a> {
}
}

impl<'a> Display for PathElement<'a> {
impl Display for PathElement<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
PathElement::Name(n) => write!(f, "{n}"),
Expand All @@ -305,13 +305,13 @@ impl<'a> From<&'a String> for PathElement<'a> {
}
}

impl<'a> From<usize> for PathElement<'a> {
impl From<usize> for PathElement<'_> {
fn from(index: usize) -> Self {
Self::Index(index)
}
}

impl<'a> Serialize for PathElement<'a> {
impl Serialize for PathElement<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down
10 changes: 5 additions & 5 deletions serde_json_path_core/src/spec/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl<'a> Deref for NodesType<'a> {
}
}

impl<'a> DerefMut for NodesType<'a> {
impl DerefMut for NodesType<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
Expand Down Expand Up @@ -341,7 +341,7 @@ pub enum ValueType<'a> {
Nothing,
}

impl<'a> ValueType<'a> {
impl ValueType<'_> {
#[doc(hidden)]
pub const fn json_path_type() -> JsonPathType {
JsonPathType::Value
Expand Down Expand Up @@ -387,7 +387,7 @@ impl<'a> TryFrom<JsonPathValue<'a>> for ValueType<'a> {
}
}

impl<'a, T> From<T> for ValueType<'a>
impl<T> From<T> for ValueType<'_>
where
T: Into<Value>,
{
Expand Down Expand Up @@ -422,7 +422,7 @@ impl<'a> From<ValueType<'a>> for JsonPathValue<'a> {
}
}

impl<'a> From<LogicalType> for JsonPathValue<'a> {
impl From<LogicalType> for JsonPathValue<'_> {
fn from(value: LogicalType) -> Self {
Self::Logical(value)
}
Expand Down Expand Up @@ -507,7 +507,7 @@ impl FunctionExpr<Validated> {
&'a self,
current: &'b Value,
root: &'b Value,
) -> JsonPathValue<'_> {
) -> JsonPathValue<'a> {
let args: VecDeque<JsonPathValue> = self
.args
.iter()
Expand Down