chore: Address Clippy errors

This commit is contained in:
Benjamin Tobler 2022-11-15 17:13:25 -08:00 committed by Dmitry Dygalo
parent aca12a7317
commit 76a0826d33
No known key found for this signature in database
GPG Key ID: 26834366E8FDCFEF
2 changed files with 6 additions and 6 deletions

View File

@ -255,10 +255,7 @@ pub(crate) fn compile_validators<'a>(
mod tests {
use super::JSONSchema;
use crate::{
compilation::options::CustomKeywordDefinition,
error::{TypeKind, ValidationError},
paths::JSONPointer,
primitive_type::PrimitiveType,
compilation::options::CustomKeywordDefinition, error::ValidationError, paths::JSONPointer,
ErrorIterator,
};
use serde_json::{from_str, json, Value};
@ -323,6 +320,7 @@ mod tests {
fn custom_keyword_defintion() {
// Define a custom validator that verifies the object's keys consist of
// only ASCII representable characters.
#[allow(clippy::needless_pass_by_value)]
fn custom_object_validator(
instance: &Value,
instance_path: JSONPointer,
@ -333,8 +331,8 @@ mod tests {
let error = ValidationError {
instance: Cow::Borrowed(instance),
kind: crate::error::ValidationErrorKind::Schema,
instance_path: instance_path.clone(),
schema_path: schema_path.clone(),
instance_path,
schema_path,
};
return Box::new(Some(error).into_iter()); // Invalid schema
}

View File

@ -8,6 +8,8 @@ use serde_json::Value;
use std::fmt::{Display, Formatter};
use std::sync::Arc;
// An Arc<Value> is used so the borrow checker doesn't need explicit lifetime parameters.
// This would pollute dependents with lifetime parameters.
pub(crate) type CustomValidateFn =
fn(&Value, JSONPointer, Arc<Value>, JSONPointer) -> ErrorIterator;
pub(crate) type CustomIsValidFn = fn(&Value, &Value) -> bool;