Skip to content

Commit 10cb315

Browse files
committed
chore: fix clippy
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent f464b8d commit 10cb315

File tree

10 files changed

+27
-26
lines changed

10 files changed

+27
-26
lines changed

crates/jsonschema-py/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn to_error_message(error: &jsonschema::ValidationError<'_>, mut message: String
267267

268268
struct StringWriter<'a>(&'a mut String);
269269

270-
impl<'a> Write for StringWriter<'a> {
270+
impl Write for StringWriter<'_> {
271271
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
272272
// SAFETY: `serde_json` always produces valid UTF-8
273273
self.0

crates/jsonschema-referencing/src/anchors/keys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl PartialEq for (dyn BorrowDyn + '_) {
7474
}
7575
}
7676

77-
impl<'a> Hash for (dyn BorrowDyn + 'a) {
77+
impl Hash for (dyn BorrowDyn + '_) {
7878
fn hash<H: Hasher>(&self, state: &mut H) {
7979
self.borrowed_key().hash(state);
8080
}

crates/jsonschema-referencing/src/resolver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ pub struct Resolver<'r> {
1616
scopes: List<Uri<String>>,
1717
}
1818

19-
impl<'r> PartialEq for Resolver<'r> {
19+
impl PartialEq for Resolver<'_> {
2020
fn eq(&self, other: &Self) -> bool {
2121
self.base_uri == other.base_uri
2222
}
2323
}
24-
impl<'r> Eq for Resolver<'r> {}
24+
impl Eq for Resolver<'_> {}
2525

26-
impl<'r> fmt::Debug for Resolver<'r> {
26+
impl fmt::Debug for Resolver<'_> {
2727
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2828
f.debug_struct("Resolver")
2929
.field("base_uri", &self.base_uri.as_str())

crates/jsonschema-referencing/src/segments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl<'a> From<Cow<'a, str>> for Segment<'a> {
3737
}
3838
}
3939

40-
impl<'a> From<usize> for Segment<'a> {
40+
impl From<usize> for Segment<'_> {
4141
fn from(value: usize) -> Self {
4242
Segment::Index(value)
4343
}

crates/jsonschema/src/compiler.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ impl<'a> Context<'a> {
130130
!matches!(self.draft, Draft::Draft4)
131131
}
132132
pub(crate) fn validates_formats_by_default(&self) -> bool {
133-
self.config
134-
.validate_formats()
135-
.unwrap_or_else(|| matches!(self.draft, Draft::Draft4 | Draft::Draft6 | Draft::Draft7))
133+
self.config.validate_formats().unwrap_or(matches!(
134+
self.draft,
135+
Draft::Draft4 | Draft::Draft6 | Draft::Draft7
136+
))
136137
}
137138
pub(crate) fn are_unknown_formats_ignored(&self) -> bool {
138139
self.config.are_unknown_formats_ignored()

crates/jsonschema/src/keywords/format.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,12 +720,12 @@ impl Validate for CustomFormatValidator {
720720
if self.is_valid(instance) {
721721
Ok(())
722722
} else {
723-
return Err(ValidationError::format(
723+
Err(ValidationError::format(
724724
self.location.clone(),
725725
location.into(),
726726
instance,
727727
self.format_name.clone(),
728-
));
728+
))
729729
}
730730
}
731731

@@ -797,12 +797,12 @@ pub(crate) fn compile<'a>(
797797
if ctx.are_unknown_formats_ignored() {
798798
None
799799
} else {
800-
return Some(Err(ValidationError::format(
800+
Some(Err(ValidationError::format(
801801
Location::new(),
802802
ctx.location().clone(),
803803
schema,
804804
"unknown format",
805-
)));
805+
)))
806806
}
807807
}
808808
}

crates/jsonschema/src/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl<'a> Iterator for NodeValidatorsIter<'a> {
402402
}
403403
}
404404

405-
impl<'a> ExactSizeIterator for NodeValidatorsIter<'a> {
405+
impl ExactSizeIterator for NodeValidatorsIter<'_> {
406406
fn len(&self) -> usize {
407407
match self {
408408
Self::NoValidator => 0,

crates/jsonschema/src/output.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct Output<'a, 'b> {
3030
instance: &'b serde_json::Value,
3131
}
3232

33-
impl<'a, 'b> Output<'a, 'b> {
33+
impl<'a> Output<'a, '_> {
3434
pub(crate) const fn new<'c, 'd>(
3535
schema: &'c Validator,
3636
root_node: &'c SchemaNode,
@@ -117,7 +117,7 @@ pub enum BasicOutput<'a> {
117117
Invalid(VecDeque<OutputUnit<ErrorDescription>>),
118118
}
119119

120-
impl<'a> BasicOutput<'a> {
120+
impl BasicOutput<'_> {
121121
/// A shortcut to check whether the output represents passed validation.
122122
#[must_use]
123123
pub const fn is_valid(&self) -> bool {
@@ -136,7 +136,7 @@ impl<'a> From<OutputUnit<Annotations<'a>>> for BasicOutput<'a> {
136136
}
137137
}
138138

139-
impl<'a> AddAssign for BasicOutput<'a> {
139+
impl AddAssign for BasicOutput<'_> {
140140
fn add_assign(&mut self, rhs: Self) {
141141
match (&mut *self, rhs) {
142142
(BasicOutput::Valid(ref mut anns), BasicOutput::Valid(anns_rhs)) => {
@@ -153,7 +153,7 @@ impl<'a> AddAssign for BasicOutput<'a> {
153153
}
154154
}
155155

156-
impl<'a> Sum for BasicOutput<'a> {
156+
impl Sum for BasicOutput<'_> {
157157
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
158158
let result = BasicOutput::Valid(VecDeque::new());
159159
iter.fold(result, |mut acc, elem| {
@@ -163,7 +163,7 @@ impl<'a> Sum for BasicOutput<'a> {
163163
}
164164
}
165165

166-
impl<'a> Default for BasicOutput<'a> {
166+
impl Default for BasicOutput<'_> {
167167
fn default() -> Self {
168168
BasicOutput::Valid(VecDeque::new())
169169
}
@@ -306,7 +306,7 @@ impl<'a> From<&'a serde_json::Value> for Annotations<'a> {
306306
}
307307
}
308308

309-
impl<'a> From<serde_json::Value> for Annotations<'a> {
309+
impl From<serde_json::Value> for Annotations<'_> {
310310
fn from(v: serde_json::Value) -> Self {
311311
Annotations(AnnotationsInner::Value(Box::new(v)))
312312
}
@@ -342,7 +342,7 @@ impl<'a> From<&'a str> for ErrorDescription {
342342
}
343343
}
344344

345-
impl<'a> serde::Serialize for BasicOutput<'a> {
345+
impl serde::Serialize for BasicOutput<'_> {
346346
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
347347
where
348348
S: serde::Serializer,
@@ -362,7 +362,7 @@ impl<'a> serde::Serialize for BasicOutput<'a> {
362362
}
363363
}
364364

365-
impl<'a> serde::Serialize for AnnotationsInner<'a> {
365+
impl serde::Serialize for AnnotationsInner<'_> {
366366
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
367367
where
368368
S: serde::Serializer,
@@ -375,7 +375,7 @@ impl<'a> serde::Serialize for AnnotationsInner<'a> {
375375
}
376376
}
377377

378-
impl<'a> serde::Serialize for OutputUnit<Annotations<'a>> {
378+
impl serde::Serialize for OutputUnit<Annotations<'_>> {
379379
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
380380
where
381381
S: serde::Serializer,

crates/jsonschema/src/paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub enum LocationSegment<'a> {
1212
Index(usize),
1313
}
1414

15-
impl<'a> fmt::Display for LocationSegment<'a> {
15+
impl fmt::Display for LocationSegment<'_> {
1616
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1717
match self {
1818
LocationSegment::Property(property) => f.write_str(property),
@@ -37,7 +37,7 @@ impl Default for LazyLocation<'_, '_> {
3737
}
3838
}
3939

40-
impl<'a, 'b> LazyLocation<'a, 'b> {
40+
impl<'a> LazyLocation<'a, '_> {
4141
/// Create a root node of a JSON pointer.
4242
pub const fn new() -> Self {
4343
LazyLocation {

0 commit comments

Comments
 (0)