Skip to content

Commit 298e4ea

Browse files
authored
Fix lint errors with toolchain 1.83 (#1561)
1 parent 5c96bec commit 298e4ea

23 files changed

+178
-89
lines changed

src/errors/validation_exception.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ struct ValidationErrorSerializer<'py> {
582582
input_type: &'py InputType,
583583
}
584584

585-
impl<'py> Serialize for ValidationErrorSerializer<'py> {
585+
impl Serialize for ValidationErrorSerializer<'_> {
586586
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
587587
where
588588
S: Serializer,
@@ -614,7 +614,7 @@ struct PyLineErrorSerializer<'py> {
614614
input_type: &'py InputType,
615615
}
616616

617-
impl<'py> Serialize for PyLineErrorSerializer<'py> {
617+
impl Serialize for PyLineErrorSerializer<'_> {
618618
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
619619
where
620620
S: Serializer,

src/input/datetime.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub enum EitherDate<'a> {
2424
Py(Bound<'a, PyDate>),
2525
}
2626

27-
impl<'a> From<Date> for EitherDate<'a> {
27+
impl From<Date> for EitherDate<'_> {
2828
fn from(date: Date) -> Self {
2929
Self::Raw(date)
3030
}
@@ -45,7 +45,7 @@ pub fn pydate_as_date(py_date: &Bound<'_, PyAny>) -> PyResult<Date> {
4545
})
4646
}
4747

48-
impl<'a> EitherDate<'a> {
48+
impl EitherDate<'_> {
4949
pub fn as_raw(&self) -> PyResult<Date> {
5050
match self {
5151
Self::Raw(date) => Ok(date.clone()),
@@ -68,7 +68,7 @@ pub enum EitherTime<'a> {
6868
Py(Bound<'a, PyTime>),
6969
}
7070

71-
impl<'a> From<Time> for EitherTime<'a> {
71+
impl From<Time> for EitherTime<'_> {
7272
fn from(time: Time) -> Self {
7373
Self::Raw(time)
7474
}
@@ -87,7 +87,7 @@ pub enum EitherTimedelta<'a> {
8787
PySubclass(Bound<'a, PyDelta>),
8888
}
8989

90-
impl<'a> From<Duration> for EitherTimedelta<'a> {
90+
impl From<Duration> for EitherTimedelta<'_> {
9191
fn from(timedelta: Duration) -> Self {
9292
Self::Raw(timedelta)
9393
}
@@ -200,7 +200,7 @@ pub fn pytime_as_time(py_time: &Bound<'_, PyAny>, py_dt: Option<&Bound<'_, PyAny
200200
})
201201
}
202202

203-
impl<'a> EitherTime<'a> {
203+
impl EitherTime<'_> {
204204
pub fn as_raw(&self) -> PyResult<Time> {
205205
match self {
206206
Self::Raw(time) => Ok(time.clone()),
@@ -240,7 +240,7 @@ pub enum EitherDateTime<'a> {
240240
Py(Bound<'a, PyDateTime>),
241241
}
242242

243-
impl<'a> From<DateTime> for EitherDateTime<'a> {
243+
impl From<DateTime> for EitherDateTime<'_> {
244244
fn from(dt: DateTime) -> Self {
245245
Self::Raw(dt)
246246
}

src/input/input_abstract.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ pub trait ValidatedSet<'py> {
268268

269269
/// This type is used for inputs which don't support certain types.
270270
/// It implements all the associated traits, but never actually gets called.
271-
272271
pub enum Never {}
273272

274273
impl<'py> ValidatedDict<'py> for Never {
@@ -330,7 +329,10 @@ impl Arguments<'_> for Never {
330329
}
331330

332331
impl<'py> PositionalArgs<'py> for Never {
333-
type Item<'a> = Bound<'py, PyAny> where Self: 'a;
332+
type Item<'a>
333+
= Bound<'py, PyAny>
334+
where
335+
Self: 'a;
334336
fn len(&self) -> usize {
335337
unreachable!()
336338
}
@@ -343,8 +345,14 @@ impl<'py> PositionalArgs<'py> for Never {
343345
}
344346

345347
impl<'py> KeywordArgs<'py> for Never {
346-
type Key<'a> = Bound<'py, PyAny> where Self: 'a;
347-
type Item<'a> = Bound<'py, PyAny> where Self: 'a;
348+
type Key<'a>
349+
= Bound<'py, PyAny>
350+
where
351+
Self: 'a;
352+
type Item<'a>
353+
= Bound<'py, PyAny>
354+
where
355+
Self: 'a;
348356
fn len(&self) -> usize {
349357
unreachable!()
350358
}

src/input/input_json.rs

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ impl<'py, 'data> Input<'py> for JsonValue<'data> {
6666
}
6767
}
6868

69-
type Arguments<'a> = JsonArgs<'a, 'data>
69+
type Arguments<'a>
70+
= JsonArgs<'a, 'data>
7071
where
71-
Self: 'a,;
72+
Self: 'a;
7273

7374
fn validate_args(&self) -> ValResult<JsonArgs<'_, 'data>> {
7475
match self {
@@ -179,7 +180,10 @@ impl<'py, 'data> Input<'py> for JsonValue<'data> {
179180
}
180181
}
181182

182-
type Dict<'a> = &'a JsonObject<'data> where Self: 'a;
183+
type Dict<'a>
184+
= &'a JsonObject<'data>
185+
where
186+
Self: 'a;
183187

184188
fn validate_dict(&self, _strict: bool) -> ValResult<Self::Dict<'_>> {
185189
match self {
@@ -192,7 +196,10 @@ impl<'py, 'data> Input<'py> for JsonValue<'data> {
192196
self.validate_dict(false)
193197
}
194198

195-
type List<'a> = &'a JsonArray<'data> where Self: 'a;
199+
type List<'a>
200+
= &'a JsonArray<'data>
201+
where
202+
Self: 'a;
196203

197204
fn validate_list(&self, _strict: bool) -> ValMatch<&JsonArray<'data>> {
198205
match self {
@@ -201,7 +208,10 @@ impl<'py, 'data> Input<'py> for JsonValue<'data> {
201208
}
202209
}
203210

204-
type Tuple<'a> = &'a JsonArray<'data> where Self: 'a;
211+
type Tuple<'a>
212+
= &'a JsonArray<'data>
213+
where
214+
Self: 'a;
205215

206216
fn validate_tuple(&self, _strict: bool) -> ValMatch<&JsonArray<'data>> {
207217
// just as in set's case, List has to be allowed
@@ -211,7 +221,10 @@ impl<'py, 'data> Input<'py> for JsonValue<'data> {
211221
}
212222
}
213223

214-
type Set<'a> = &'a JsonArray<'data> where Self: 'a;
224+
type Set<'a>
225+
= &'a JsonArray<'data>
226+
where
227+
Self: 'a;
215228

216229
fn validate_set(&self, _strict: bool) -> ValMatch<&JsonArray<'data>> {
217230
// we allow a list here since otherwise it would be impossible to create a set from JSON
@@ -501,10 +514,16 @@ fn string_to_vec(s: &str) -> JsonArray<'static> {
501514
JsonArray::new(s.chars().map(|c| JsonValue::Str(c.to_string().into())).collect())
502515
}
503516

504-
impl<'py, 'data> ValidatedDict<'py> for &'_ JsonObject<'data> {
505-
type Key<'a> = &'a str where Self: 'a;
517+
impl<'data> ValidatedDict<'_> for &'_ JsonObject<'data> {
518+
type Key<'a>
519+
= &'a str
520+
where
521+
Self: 'a;
506522

507-
type Item<'a> = &'a JsonValue<'data> where Self: 'a;
523+
type Item<'a>
524+
= &'a JsonValue<'data>
525+
where
526+
Self: 'a;
508527

509528
fn get_item<'k>(&self, key: &'k LookupKey) -> ValResult<Option<(&'k LookupPath, Self::Item<'_>)>> {
510529
key.json_get(self)
@@ -567,7 +586,7 @@ impl<'a, 'data> JsonArgs<'a, 'data> {
567586
}
568587
}
569588

570-
impl<'a, 'data> Arguments<'_> for JsonArgs<'a, 'data> {
589+
impl<'data> Arguments<'_> for JsonArgs<'_, 'data> {
571590
type Args = [JsonValue<'data>];
572591
type Kwargs = JsonObject<'data>;
573592

@@ -581,7 +600,10 @@ impl<'a, 'data> Arguments<'_> for JsonArgs<'a, 'data> {
581600
}
582601

583602
impl<'data> PositionalArgs<'_> for [JsonValue<'data>] {
584-
type Item<'a> = &'a JsonValue<'data> where Self: 'a;
603+
type Item<'a>
604+
= &'a JsonValue<'data>
605+
where
606+
Self: 'a;
585607

586608
fn len(&self) -> usize {
587609
<[JsonValue]>::len(self)
@@ -595,8 +617,14 @@ impl<'data> PositionalArgs<'_> for [JsonValue<'data>] {
595617
}
596618

597619
impl<'data> KeywordArgs<'_> for JsonObject<'data> {
598-
type Key<'a> = &'a str where Self: 'a;
599-
type Item<'a> = &'a JsonValue<'data> where Self: 'a;
620+
type Key<'a>
621+
= &'a str
622+
where
623+
Self: 'a;
624+
type Item<'a>
625+
= &'a JsonValue<'data>
626+
where
627+
Self: 'a;
600628

601629
fn len(&self) -> usize {
602630
LazyIndexMap::len(self)

src/input/input_python.rs

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
9393
.map(|dict| dict.to_owned().unbind().into_bound(py))
9494
}
9595

96-
type Arguments<'a> = PyArgs<'py> where Self: 'a;
96+
type Arguments<'a>
97+
= PyArgs<'py>
98+
where
99+
Self: 'a;
97100

98101
fn validate_args(&self) -> ValResult<PyArgs<'py>> {
99102
if let Ok(dict) = self.downcast::<PyDict>() {
@@ -350,7 +353,10 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
350353
Err(ValError::new(error_type, self))
351354
}
352355

353-
type Dict<'a> = GenericPyMapping<'a, 'py> where Self: 'a;
356+
type Dict<'a>
357+
= GenericPyMapping<'a, 'py>
358+
where
359+
Self: 'a;
354360

355361
fn strict_dict<'a>(&'a self) -> ValResult<GenericPyMapping<'a, 'py>> {
356362
if let Ok(dict) = self.downcast::<PyDict>() {
@@ -404,7 +410,10 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
404410
}
405411
}
406412

407-
type List<'a> = PySequenceIterable<'a, 'py> where Self: 'a;
413+
type List<'a>
414+
= PySequenceIterable<'a, 'py>
415+
where
416+
Self: 'a;
408417

409418
fn validate_list<'a>(&'a self, strict: bool) -> ValMatch<PySequenceIterable<'a, 'py>> {
410419
if let Ok(list) = self.downcast::<PyList>() {
@@ -418,7 +427,10 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
418427
Err(ValError::new(ErrorTypeDefaults::ListType, self))
419428
}
420429

421-
type Tuple<'a> = PySequenceIterable<'a, 'py> where Self: 'a;
430+
type Tuple<'a>
431+
= PySequenceIterable<'a, 'py>
432+
where
433+
Self: 'a;
422434

423435
fn validate_tuple<'a>(&'a self, strict: bool) -> ValMatch<PySequenceIterable<'a, 'py>> {
424436
if let Ok(tup) = self.downcast::<PyTuple>() {
@@ -432,7 +444,10 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
432444
Err(ValError::new(ErrorTypeDefaults::TupleType, self))
433445
}
434446

435-
type Set<'a> = PySequenceIterable<'a, 'py> where Self: 'a;
447+
type Set<'a>
448+
= PySequenceIterable<'a, 'py>
449+
where
450+
Self: 'a;
436451

437452
fn validate_set<'a>(&'a self, strict: bool) -> ValMatch<PySequenceIterable<'a, 'py>> {
438453
if let Ok(set) = self.downcast::<PySet>() {
@@ -742,7 +757,10 @@ impl<'py> Arguments<'py> for PyArgs<'py> {
742757
}
743758

744759
impl<'py> PositionalArgs<'py> for PyPosArgs<'py> {
745-
type Item<'a> = Borrowed<'a, 'py, PyAny> where Self: 'a;
760+
type Item<'a>
761+
= Borrowed<'a, 'py, PyAny>
762+
where
763+
Self: 'a;
746764

747765
fn len(&self) -> usize {
748766
self.0.len()
@@ -758,11 +776,13 @@ impl<'py> PositionalArgs<'py> for PyPosArgs<'py> {
758776
}
759777

760778
impl<'py> KeywordArgs<'py> for PyKwargs<'py> {
761-
type Key<'a> = Bound<'py, PyAny>
779+
type Key<'a>
780+
= Bound<'py, PyAny>
762781
where
763782
Self: 'a;
764783

765-
type Item<'a> = Bound<'py, PyAny>
784+
type Item<'a>
785+
= Bound<'py, PyAny>
766786
where
767787
Self: 'a;
768788

@@ -790,11 +810,13 @@ pub enum GenericPyMapping<'a, 'py> {
790810
}
791811

792812
impl<'py> ValidatedDict<'py> for GenericPyMapping<'_, 'py> {
793-
type Key<'a> = Bound<'py, PyAny>
813+
type Key<'a>
814+
= Bound<'py, PyAny>
794815
where
795816
Self: 'a;
796817

797-
type Item<'a> = Bound<'py, PyAny>
818+
type Item<'a>
819+
= Bound<'py, PyAny>
798820
where
799821
Self: 'a;
800822

0 commit comments

Comments
 (0)