Skip to content

Commit e572f55

Browse files
Linting / formatting updates (#1603)
1 parent 2c27319 commit e572f55

File tree

14 files changed

+14
-25
lines changed

14 files changed

+14
-25
lines changed

src/serializers/fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ impl TypeSerializer for GeneralFieldsSerializer {
458458
map.end()
459459
}
460460

461-
fn get_name(&self) -> &str {
461+
fn get_name(&self) -> &'static str {
462462
"general-fields"
463463
}
464464
}

src/serializers/type_serializers/complex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl TypeSerializer for ComplexSerializer {
6868
}
6969
}
7070

71-
fn get_name(&self) -> &str {
71+
fn get_name(&self) -> &'static str {
7272
"complex"
7373
}
7474
}

src/serializers/type_serializers/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl FunctionPlainSerializer {
183183
fn retry_with_lax_check(&self) -> bool {
184184
self.fallback_serializer
185185
.as_ref()
186-
.map_or(false, |f| f.retry_with_lax_check())
186+
.is_some_and(|f| f.retry_with_lax_check())
187187
|| self.return_serializer.retry_with_lax_check()
188188
}
189189
}

src/validators/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl Validator for BytesConstrainedValidator {
107107
Ok(either_bytes.into_py_any(py)?)
108108
}
109109

110-
fn get_name(&self) -> &str {
110+
fn get_name(&self) -> &'static str {
111111
"constrained-bytes"
112112
}
113113
}

src/validators/complex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Validator for ComplexValidator {
4949
Ok(res.into_pyobject(py)?.into())
5050
}
5151

52-
fn get_name(&self) -> &str {
52+
fn get_name(&self) -> &'static str {
5353
"complex"
5454
}
5555
}

src/validators/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl Validator for ConstrainedFloatValidator {
168168
Ok(either_float.into_py_any(py)?)
169169
}
170170

171-
fn get_name(&self) -> &str {
171+
fn get_name(&self) -> &'static str {
172172
"constrained-float"
173173
}
174174
}

src/validators/int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl Validator for ConstrainedIntValidator {
140140
Ok(either_int.into_py_any(py)?)
141141
}
142142

143-
fn get_name(&self) -> &str {
143+
fn get_name(&self) -> &'static str {
144144
"constrained-int"
145145
}
146146
}

src/validators/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl Validator for StrConstrainedValidator {
147147
Ok(py_string.into_py_any(py)?)
148148
}
149149

150-
fn get_name(&self) -> &str {
150+
fn get_name(&self) -> &'static str {
151151
"constrained-str"
152152
}
153153
}

src/validators/typed_dict.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,7 @@ impl Validator for TypedDictValidator {
312312
ExtraBehavior::Allow => {
313313
let py_key = either_str.as_py_string(self.py, self.state.cache_str());
314314
if let Some(validator) = self.extras_validator {
315-
let last_partial = self.partial_last_key.as_ref().map_or(false, |last_key| {
316-
let key_loc: LocItem = raw_key.clone().into();
317-
&key_loc == last_key
318-
});
315+
let last_partial = self.partial_last_key.as_ref() == Some(&raw_key.clone().into());
319316
self.state.allow_partial = match last_partial {
320317
true => self.allow_partial,
321318
false => false.into(),

tests/benchmarks/nested_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def schema_using_defs() -> cs.CoreSchema:
4040
'fields': {
4141
str(c): {
4242
'type': 'model-field',
43-
'schema': {'type': 'definition-ref', 'schema_ref': f'model_{level+1}'},
43+
'schema': {'type': 'definition-ref', 'schema_ref': f'model_{level + 1}'},
4444
}
4545
for c in range(N)
4646
},

0 commit comments

Comments
 (0)