Handle missing source in filter_assoc_items
@@ -98,13 +98,14 @@ pub fn filter_assoc_items(
items
.iter()
- .map(|i| {
- #[allow(deprecated)]
- match i {
- hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value),
- hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value),
- hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value),
- }
+ // Note: This throws away items with no source.
+ .filter_map(|i| {
+ let item = match i {
+ hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(db)?.value),
+ hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(db)?.value),
+ hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source(db)?.value),
+ };
+ Some(item)
})
.filter(has_def_name)
.filter(|it| match it {
