mirror of https://github.com/astral-sh/ruff
lifetime insanity
This commit is contained in:
parent
6453a0ba48
commit
36a8edaf4b
|
|
@ -490,13 +490,16 @@ impl<'db> PyIndex<'db> for &FixedLengthTuple<Type<'db>> {
|
||||||
impl<'db> PySlice<'db> for FixedLengthTuple<Type<'db>> {
|
impl<'db> PySlice<'db> for FixedLengthTuple<Type<'db>> {
|
||||||
type Item = Type<'db>;
|
type Item = Type<'db>;
|
||||||
|
|
||||||
fn py_slice(
|
fn py_slice<'self_>(
|
||||||
&'db self,
|
&'self_ self,
|
||||||
db: &'db dyn Db,
|
db: &'db dyn Db,
|
||||||
start: Option<i32>,
|
start: Option<i32>,
|
||||||
stop: Option<i32>,
|
stop: Option<i32>,
|
||||||
step: Option<i32>,
|
step: Option<i32>,
|
||||||
) -> Result<impl Iterator<Item = &'db Self::Item>, StepSizeZeroError> {
|
) -> Result<impl Iterator<Item = &'self_ Self::Item>, StepSizeZeroError>
|
||||||
|
where
|
||||||
|
'db: 'self_,
|
||||||
|
{
|
||||||
self.0.py_slice(db, start, stop, step)
|
self.0.py_slice(db, start, stop, step)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,25 +110,30 @@ pub(crate) struct StepSizeZeroError;
|
||||||
pub(crate) trait PySlice<'db> {
|
pub(crate) trait PySlice<'db> {
|
||||||
type Item: 'db;
|
type Item: 'db;
|
||||||
|
|
||||||
fn py_slice(
|
fn py_slice<'self_>(
|
||||||
&'db self,
|
&'self_ self,
|
||||||
db: &'db dyn Db,
|
db: &'db dyn Db,
|
||||||
start: Option<i32>,
|
start: Option<i32>,
|
||||||
stop: Option<i32>,
|
stop: Option<i32>,
|
||||||
step: Option<i32>,
|
step: Option<i32>,
|
||||||
) -> Result<impl Iterator<Item = &'db Self::Item>, StepSizeZeroError>;
|
) -> Result<impl Iterator<Item = &'self_ Self::Item>, StepSizeZeroError>
|
||||||
|
where
|
||||||
|
'db: 'self_;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'db, T: 'db> PySlice<'db> for [T] {
|
impl<'db, T: 'db> PySlice<'db> for [T] {
|
||||||
type Item = T;
|
type Item = T;
|
||||||
|
|
||||||
fn py_slice(
|
fn py_slice<'self_>(
|
||||||
&'db self,
|
&'self_ self,
|
||||||
_db: &'db dyn Db,
|
_db: &'db dyn Db,
|
||||||
start: Option<i32>,
|
start: Option<i32>,
|
||||||
stop: Option<i32>,
|
stop: Option<i32>,
|
||||||
step_int: Option<i32>,
|
step_int: Option<i32>,
|
||||||
) -> Result<impl Iterator<Item = &'db Self::Item>, StepSizeZeroError> {
|
) -> Result<impl Iterator<Item = &'self_ Self::Item>, StepSizeZeroError>
|
||||||
|
where
|
||||||
|
'db: 'self_,
|
||||||
|
{
|
||||||
let step_int = step_int.unwrap_or(1);
|
let step_int = step_int.unwrap_or(1);
|
||||||
if step_int == 0 {
|
if step_int == 0 {
|
||||||
return Err(StepSizeZeroError);
|
return Err(StepSizeZeroError);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue