diff --git a/crates/jsonschema-py/src/lib.rs b/crates/jsonschema-py/src/lib.rs index e5e8ed91..41b3dcfa 100644 --- a/crates/jsonschema-py/src/lib.rs +++ b/crates/jsonschema-py/src/lib.rs @@ -267,7 +267,7 @@ fn to_error_message(error: &jsonschema::ValidationError<'_>, mut message: String struct StringWriter<'a>(&'a mut String); -impl<'a> Write for StringWriter<'a> { +impl Write for StringWriter<'_> { fn write(&mut self, buf: &[u8]) -> std::io::Result { // SAFETY: `serde_json` always produces valid UTF-8 self.0 diff --git a/crates/jsonschema-referencing/src/anchors/keys.rs b/crates/jsonschema-referencing/src/anchors/keys.rs index 393311fa..882ee9e6 100644 --- a/crates/jsonschema-referencing/src/anchors/keys.rs +++ b/crates/jsonschema-referencing/src/anchors/keys.rs @@ -74,7 +74,7 @@ impl PartialEq for (dyn BorrowDyn + '_) { } } -impl<'a> Hash for (dyn BorrowDyn + 'a) { +impl Hash for (dyn BorrowDyn + '_) { fn hash(&self, state: &mut H) { self.borrowed_key().hash(state); } diff --git a/crates/jsonschema-referencing/src/resolver.rs b/crates/jsonschema-referencing/src/resolver.rs index 21ea9766..63abbe60 100644 --- a/crates/jsonschema-referencing/src/resolver.rs +++ b/crates/jsonschema-referencing/src/resolver.rs @@ -16,14 +16,14 @@ pub struct Resolver<'r> { scopes: List>, } -impl<'r> PartialEq for Resolver<'r> { +impl PartialEq for Resolver<'_> { fn eq(&self, other: &Self) -> bool { self.base_uri == other.base_uri } } -impl<'r> Eq for Resolver<'r> {} +impl Eq for Resolver<'_> {} -impl<'r> fmt::Debug for Resolver<'r> { +impl fmt::Debug for Resolver<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Resolver") .field("base_uri", &self.base_uri.as_str()) diff --git a/crates/jsonschema-referencing/src/segments.rs b/crates/jsonschema-referencing/src/segments.rs index 531d7a0c..f3d5c695 100644 --- a/crates/jsonschema-referencing/src/segments.rs +++ b/crates/jsonschema-referencing/src/segments.rs @@ -37,7 +37,7 @@ impl<'a> From> for Segment<'a> { } } -impl<'a> From for Segment<'a> { +impl From for Segment<'_> { fn from(value: usize) -> Self { Segment::Index(value) } diff --git a/crates/jsonschema-referencing/tests/suite b/crates/jsonschema-referencing/tests/suite index 3c8a655f..7033fb9a 160000 --- a/crates/jsonschema-referencing/tests/suite +++ b/crates/jsonschema-referencing/tests/suite @@ -1 +1 @@ -Subproject commit 3c8a655f7bea98d7ae2529ff37253966f4d0b3c2 +Subproject commit 7033fb9a284f266b2e9881ad4716ac0eccf9f79e diff --git a/crates/jsonschema/src/compiler.rs b/crates/jsonschema/src/compiler.rs index 39d93ecf..bd7d0766 100644 --- a/crates/jsonschema/src/compiler.rs +++ b/crates/jsonschema/src/compiler.rs @@ -130,9 +130,10 @@ impl<'a> Context<'a> { !matches!(self.draft, Draft::Draft4) } pub(crate) fn validates_formats_by_default(&self) -> bool { - self.config - .validate_formats() - .unwrap_or_else(|| matches!(self.draft, Draft::Draft4 | Draft::Draft6 | Draft::Draft7)) + self.config.validate_formats().unwrap_or(matches!( + self.draft, + Draft::Draft4 | Draft::Draft6 | Draft::Draft7 + )) } pub(crate) fn are_unknown_formats_ignored(&self) -> bool { self.config.are_unknown_formats_ignored() diff --git a/crates/jsonschema/src/keywords/format.rs b/crates/jsonschema/src/keywords/format.rs index 6f8a59bb..a133cd56 100644 --- a/crates/jsonschema/src/keywords/format.rs +++ b/crates/jsonschema/src/keywords/format.rs @@ -720,12 +720,12 @@ impl Validate for CustomFormatValidator { if self.is_valid(instance) { Ok(()) } else { - return Err(ValidationError::format( + Err(ValidationError::format( self.location.clone(), location.into(), instance, self.format_name.clone(), - )); + )) } } @@ -797,12 +797,12 @@ pub(crate) fn compile<'a>( if ctx.are_unknown_formats_ignored() { None } else { - return Some(Err(ValidationError::format( + Some(Err(ValidationError::format( Location::new(), ctx.location().clone(), schema, "unknown format", - ))); + ))) } } } diff --git a/crates/jsonschema/src/node.rs b/crates/jsonschema/src/node.rs index d07dffc0..40b24b3c 100644 --- a/crates/jsonschema/src/node.rs +++ b/crates/jsonschema/src/node.rs @@ -402,7 +402,7 @@ impl<'a> Iterator for NodeValidatorsIter<'a> { } } -impl<'a> ExactSizeIterator for NodeValidatorsIter<'a> { +impl ExactSizeIterator for NodeValidatorsIter<'_> { fn len(&self) -> usize { match self { Self::NoValidator => 0, diff --git a/crates/jsonschema/src/output.rs b/crates/jsonschema/src/output.rs index e2984937..632600ca 100644 --- a/crates/jsonschema/src/output.rs +++ b/crates/jsonschema/src/output.rs @@ -30,7 +30,7 @@ pub struct Output<'a, 'b> { instance: &'b serde_json::Value, } -impl<'a, 'b> Output<'a, 'b> { +impl<'a> Output<'a, '_> { pub(crate) const fn new<'c, 'd>( schema: &'c Validator, root_node: &'c SchemaNode, @@ -117,7 +117,7 @@ pub enum BasicOutput<'a> { Invalid(VecDeque>), } -impl<'a> BasicOutput<'a> { +impl BasicOutput<'_> { /// A shortcut to check whether the output represents passed validation. #[must_use] pub const fn is_valid(&self) -> bool { @@ -136,7 +136,7 @@ impl<'a> From>> for BasicOutput<'a> { } } -impl<'a> AddAssign for BasicOutput<'a> { +impl AddAssign for BasicOutput<'_> { fn add_assign(&mut self, rhs: Self) { match (&mut *self, rhs) { (BasicOutput::Valid(ref mut anns), BasicOutput::Valid(anns_rhs)) => { @@ -153,7 +153,7 @@ impl<'a> AddAssign for BasicOutput<'a> { } } -impl<'a> Sum for BasicOutput<'a> { +impl Sum for BasicOutput<'_> { fn sum>(iter: I) -> Self { let result = BasicOutput::Valid(VecDeque::new()); iter.fold(result, |mut acc, elem| { @@ -163,7 +163,7 @@ impl<'a> Sum for BasicOutput<'a> { } } -impl<'a> Default for BasicOutput<'a> { +impl Default for BasicOutput<'_> { fn default() -> Self { BasicOutput::Valid(VecDeque::new()) } @@ -306,7 +306,7 @@ impl<'a> From<&'a serde_json::Value> for Annotations<'a> { } } -impl<'a> From for Annotations<'a> { +impl From for Annotations<'_> { fn from(v: serde_json::Value) -> Self { Annotations(AnnotationsInner::Value(Box::new(v))) } @@ -342,7 +342,7 @@ impl<'a> From<&'a str> for ErrorDescription { } } -impl<'a> serde::Serialize for BasicOutput<'a> { +impl serde::Serialize for BasicOutput<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -362,7 +362,7 @@ impl<'a> serde::Serialize for BasicOutput<'a> { } } -impl<'a> serde::Serialize for AnnotationsInner<'a> { +impl serde::Serialize for AnnotationsInner<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -375,7 +375,7 @@ impl<'a> serde::Serialize for AnnotationsInner<'a> { } } -impl<'a> serde::Serialize for OutputUnit> { +impl serde::Serialize for OutputUnit> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crates/jsonschema/src/paths.rs b/crates/jsonschema/src/paths.rs index 73ea2d90..71f32864 100644 --- a/crates/jsonschema/src/paths.rs +++ b/crates/jsonschema/src/paths.rs @@ -12,7 +12,7 @@ pub enum LocationSegment<'a> { Index(usize), } -impl<'a> fmt::Display for LocationSegment<'a> { +impl fmt::Display for LocationSegment<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { LocationSegment::Property(property) => f.write_str(property), @@ -37,7 +37,7 @@ impl Default for LazyLocation<'_, '_> { } } -impl<'a, 'b> LazyLocation<'a, 'b> { +impl<'a> LazyLocation<'a, '_> { /// Create a root node of a JSON pointer. pub const fn new() -> Self { LazyLocation {