diff options
author | Nick Spain <[email protected]> | 2021-01-01 05:49:44 +0000 |
---|---|---|
committer | Nick Spain <[email protected]> | 2021-01-02 10:53:52 +0000 |
commit | 0a9b73524059cf29a19f9333c7753c11e268ef51 (patch) | |
tree | 34caf37114133fc54748f6379b73ff12d5174d35 /crates | |
parent | 1c009c9f1243d81c5caee082ce638d60c955a1bb (diff) |
Handle missing source in filter_assoc_items
Diffstat (limited to 'crates')
-rw-r--r-- | crates/assists/src/utils.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index d15e5a24b..7c159b5ba 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs | |||
@@ -98,13 +98,14 @@ pub fn filter_assoc_items( | |||
98 | 98 | ||
99 | items | 99 | items |
100 | .iter() | 100 | .iter() |
101 | .map(|i| { | 101 | // Note: This throws away items with no source. |
102 | #[allow(deprecated)] | 102 | .filter_map(|i| { |
103 | match i { | 103 | let item = match i { |
104 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), | 104 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(db)?.value), |
105 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), | 105 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(db)?.value), |
106 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), | 106 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source(db)?.value), |
107 | } | 107 | }; |
108 | Some(item) | ||
108 | }) | 109 | }) |
109 | .filter(has_def_name) | 110 | .filter(has_def_name) |
110 | .filter(|it| match it { | 111 | .filter(|it| match it { |