mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Add smart completions that skip await or iter() and into_iter()
E.g. complete `await.foo()`.
This commit is contained in:
parent
8364ef2997
commit
cec9fa1606
7 changed files with 230 additions and 72 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue