fix: Don't count commas when looking for the derive attribute in diagnostics

This commit is contained in:
Lukas Wirth 2022-02-21 13:43:42 +01:00
parent d6ed146a1c
commit 8cdef2ffcf

View File

@ -649,6 +649,7 @@ fn emit_def_diagnostic(db: &dyn HirDatabase, acc: &mut Vec<AnyDiagnostic>, diag:
}) })
.group_by(|t| t.kind() == T![,]) .group_by(|t| t.kind() == T![,])
.into_iter() .into_iter()
.filter(|&(comma, _)| !comma)
.nth(*derive_index as usize) .nth(*derive_index as usize)
.and_then(|(_, mut g)| g.find(|t| t.kind() == T![ident])) .and_then(|(_, mut g)| g.find(|t| t.kind() == T![ident]))
})(); })();