diff options
author | Lukas Wirth <[email protected]> | 2020-10-07 11:13:32 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2020-10-07 11:14:08 +0100 |
commit | e106857e80d1ea304b00b5ff8a3294ca9bacd959 (patch) | |
tree | b8f78f6e5218568046f09ba9ecb2c7fee924eb53 /crates/ide | |
parent | 209e9b9926d27ac71bc054bfdd48888e5d7d6d1a (diff) |
Shorten iterator hints for std::iter iterators behind references
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/inlay_hints.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 279d02541..7540f56a4 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs | |||
@@ -211,7 +211,9 @@ fn hint_iterator( | |||
211 | ty: &Type, | 211 | ty: &Type, |
212 | ) -> Option<SmolStr> { | 212 | ) -> Option<SmolStr> { |
213 | let db = sema.db; | 213 | let db = sema.db; |
214 | let strukt = ty.as_adt()?; | 214 | let strukt = std::iter::successors(Some(ty.clone()), |ty| ty.remove_ref()) |
215 | .last() | ||
216 | .and_then(|strukt| strukt.as_adt())?; | ||
215 | let krate = strukt.krate(db)?; | 217 | let krate = strukt.krate(db)?; |
216 | if krate.declaration_name(db).as_deref() != Some("core") { | 218 | if krate.declaration_name(db).as_deref() != Some("core") { |
217 | return None; | 219 | return None; |
@@ -1169,7 +1171,7 @@ fn main() { | |||
1169 | InlayHint { | 1171 | InlayHint { |
1170 | range: 175..225, | 1172 | range: 175..225, |
1171 | kind: ChainingHint, | 1173 | kind: ChainingHint, |
1172 | label: "&mut Take<&mut MyIter>", | 1174 | label: "impl Iterator<Item = ()>", |
1173 | }, | 1175 | }, |
1174 | InlayHint { | 1176 | InlayHint { |
1175 | range: 175..207, | 1177 | range: 175..207, |