From 8cdef2ffcf09e1830d62eb82e0b484341bec39f0 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 21 Feb 2022 13:43:42 +0100 Subject: [PATCH] fix: Don't count commas when looking for the derive attribute in diagnostics --- crates/hir/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c75ceed9e3..a26d8e9ebf 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -649,6 +649,7 @@ fn emit_def_diagnostic(db: &dyn HirDatabase, acc: &mut Vec, diag: }) .group_by(|t| t.kind() == T![,]) .into_iter() + .filter(|&(comma, _)| !comma) .nth(*derive_index as usize) .and_then(|(_, mut g)| g.find(|t| t.kind() == T![ident])) })();