Reduce allocations in attribute collection

This commit is contained in:
Lukas Wirth 2022-01-30 22:18:32 +01:00
parent c08df0f1f5
commit cc04cfc982
9 changed files with 61 additions and 70 deletions

View file

@ -664,7 +664,7 @@ fn emit_def_diagnostic(db: &dyn HirDatabase, acc: &mut Vec<AnyDiagnostic>, diag:
let attr = node
.doc_comments_and_attrs()
.nth((*invoc_attr_index) as usize)
.and_then(Either::right)
.and_then(Either::left)
.unwrap_or_else(|| panic!("cannot find attribute #{}", invoc_attr_index));
(
ast_id.with_value(SyntaxNodePtr::from(AstPtr::new(&attr))),