mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
Handle missing source in filter_assoc_items
This commit is contained in:
parent
1c009c9f12
commit
0a9b735240
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user