Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
Regarding the panic, the `panic!("... {dir:?}")` syntax is only
supported in the rust 2021 edition, but valico is only using rust 2018.
  • Loading branch information
erickt committed Mar 7, 2024
1 parent 62502c2 commit aa09dda
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/json_schema/validators/content_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ impl super::Validator for ContentMedia {
None
};

let val_ = if decoded_val.is_some() {
decoded_val.as_ref().unwrap()
let val_ = if let Some(decoded_val) = &decoded_val {
decoded_val
} else {
val
};
Expand Down
2 changes: 1 addition & 1 deletion src/json_schema/validators/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub mod tests {
let result = validate_regex("FOO\\");
assert_eq!(result.errors.len(), 1);

let only_err = result.errors.get(0);
let only_err = result.errors.first();
assert!(only_err.is_some());

let err = only_err.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ where
F: Fn(&path::Path, Value) + Copy,
{
let mut contents = fs::read_dir(dir)
.unwrap_or_else(|_| panic!("cannot list directory {dir:?}"))
.unwrap_or_else(|_| panic!("cannot list directory {:?}", dir))
.collect::<Vec<_>>();
contents.sort_by_key(|v| v.as_ref().unwrap().file_name());
for entry in contents {
Expand Down

0 comments on commit aa09dda

Please sign in to comment.