Add smart completions that skip await or iter() and into_iter()

E.g. complete `await.foo()`.
This commit is contained in:
Chayim Refael Friedman 2025-01-12 21:25:33 +02:00
parent 8364ef2997
commit cec9fa1606
7 changed files with 230 additions and 72 deletions

View file

@ -1510,7 +1510,7 @@ pub mod iter {
impl<T, const N: usize> IntoIterator for [T; N] {
type Item = T;
type IntoIter = IntoIter<T, N>;
fn into_iter(self) -> I {
fn into_iter(self) -> Self::IntoIter {
IntoIter { data: self, range: IndexRange { start: 0, end: loop {} } }
}
}
@ -1520,6 +1520,29 @@ pub mod iter {
loop {}
}
}
pub struct Iter<'a, T> {
slice: &'a [T],
}
impl<'a, T> IntoIterator for &'a [T; N] {
type Item = &'a T;
type IntoIter = Iter<'a, T>;
fn into_iter(self) -> Self::IntoIter {
loop {}
}
}
impl<'a, T> IntoIterator for &'a [T] {
type Item = &'a T;
type IntoIter = Iter<'a, T>;
fn into_iter(self) -> Self::IntoIter {
loop {}
}
}
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<T> {
loop {}
}
}
}
pub use self::collect::IntoIterator;
}