update: validator crate

This commit is contained in:
noshishiRust
2024-04-11 08:29:21 +09:00
parent 4550abc1be
commit e0cbabeb03
3 changed files with 8 additions and 8 deletions

View File

@@ -252,8 +252,8 @@ pub mod tests {
assert_eq!(&inner, v.deref());
assert_eq!(inner, v.into_inner());
fn validate(v: &i32, args: &DataVA) -> Result<(), ValidationError> {
assert!(*v < args.a);
fn validate(v: i32, args: &DataVA) -> Result<(), ValidationError> {
assert!(v < args.a);
Ok(())
}

View File

@@ -47,10 +47,10 @@ pub struct ParametersEx {
v1: String,
}
fn validate_v0(v: &i32, args: &ParametersExValidationArguments) -> Result<(), ValidationError> {
fn validate_v0(v: i32, args: &ParametersExValidationArguments) -> Result<(), ValidationError> {
args.inner
.v0_range
.contains(v)
.contains(&v)
.then_some(())
.ok_or_else(|| ValidationError::new("v0 is out of range"))
}
@@ -1208,11 +1208,11 @@ mod extra_typed_path {
}
fn validate_v0(
v: &i32,
v: i32,
args: &TypedPathParamExValidationArguments,
) -> Result<(), ValidationError> {
args.v0_range
.contains(v)
.contains(&v)
.then_some(())
.ok_or_else(|| ValidationError::new("v0 is out of range"))
}