Skip to content

Commit 57c1409

Browse files
committed
Merge branch 'new-alias-api' of https://github.com/pydantic/pydantic-core into new-alias-api
2 parents 06e8564 + b5e3b4c commit 57c1409

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/serializers/extra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl<'a> Extra<'a> {
206206
}
207207

208208
pub fn serialize_by_alias_or(&self, serialize_by_alias: Option<bool>) -> bool {
209-
self.by_alias.unwrap_or(serialize_by_alias.unwrap_or(false))
209+
self.by_alias.or(serialize_by_alias).unwrap_or(false)
210210
}
211211
}
212212

src/validators/validation_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ impl<'a, 'py> ValidationState<'a, 'py> {
6565
}
6666

6767
pub fn validate_by_alias_or(&self, default: Option<bool>) -> bool {
68-
self.extra.by_alias.unwrap_or(default.unwrap_or(true))
68+
self.extra.by_alias.or(default).unwrap_or(true)
6969
}
7070

7171
pub fn validate_by_name_or(&self, default: Option<bool>) -> bool {
72-
self.extra.by_name.unwrap_or(default.unwrap_or(false))
72+
self.extra.by_name.or(default).unwrap_or(false)
7373
}
7474

7575
/// Sets the exactness to the lower of the current exactness

0 commit comments

Comments
 (0)