Minor refactoring find field (#2055)

* Minor refactoring

Moving find_field_with_default to Schema.

* Clippy comments
This commit is contained in:
Paul Masurel
2023-05-22 15:00:48 +09:00
committed by GitHub
parent 4417be165d
commit d7e97331e5

View File

@@ -426,7 +426,7 @@ impl Schema {
) -> Option<(Field, &'a str)> {
let (field, json_path) = self
.find_field(full_path)
.or(default_field_opt.and_then(|field| Some((field, full_path))))?;
.or(default_field_opt.map(|field| (field, full_path)))?;
let field_entry = self.get_field_entry(field);
let is_json = field_entry.field_type().value_type() == Type::Json;
if is_json == json_path.is_empty() {