aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-16 18:27:06 +0100
committerLukas Wirth <[email protected]>2021-06-16 18:27:06 +0100
commita92ed1eef4a5804c474221d1088dafb5d45f1378 (patch)
treebf383240b8ab98ab7f11eccb84f8e355c0dfc131 /crates/ide_completion
parent8f936c557162d66a451f10481ff726a37b27302e (diff)
Don't complete already used derive attributes
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/attribute/derive.rs40
1 files changed, 20 insertions, 20 deletions
diff --git a/crates/ide_completion/src/completions/attribute/derive.rs b/crates/ide_completion/src/completions/attribute/derive.rs
index c59add6c5..20bbbba46 100644
--- a/crates/ide_completion/src/completions/attribute/derive.rs
+++ b/crates/ide_completion/src/completions/attribute/derive.rs
@@ -31,6 +31,8 @@ pub(super) fn complete_derive(
31 let lookup = components.join(", "); 31 let lookup = components.join(", ");
32 let label = components.iter().rev().join(", "); 32 let label = components.iter().rev().join(", ");
33 (label, Some(lookup)) 33 (label, Some(lookup))
34 } else if existing_derives.contains(&derive) {
35 continue;
34 } else { 36 } else {
35 (derive, None) 37 (derive, None)
36 }; 38 };
@@ -139,16 +141,15 @@ pub macro Ord {}
139 check( 141 check(
140 r#"#[derive(serde::Serialize, PartialEq, $0)] struct Test;"#, 142 r#"#[derive(serde::Serialize, PartialEq, $0)] struct Test;"#,
141 expect![[r#" 143 expect![[r#"
142 at PartialEq 144 at Default
143 at Default 145 at Eq
144 at Eq 146 at Eq, PartialOrd, Ord
145 at Eq, PartialOrd, Ord 147 at Clone, Copy
146 at Clone, Copy 148 at Debug
147 at Debug 149 at Clone
148 at Clone 150 at Hash
149 at Hash 151 at PartialOrd
150 at PartialOrd 152 "#]],
151 "#]],
152 ) 153 )
153 } 154 }
154 155
@@ -157,16 +158,15 @@ pub macro Ord {}
157 check( 158 check(
158 r#"#[derive($0 serde::Serialize, PartialEq)] struct Test;"#, 159 r#"#[derive($0 serde::Serialize, PartialEq)] struct Test;"#,
159 expect![[r#" 160 expect![[r#"
160 at PartialEq 161 at Default
161 at Default 162 at Eq
162 at Eq 163 at Eq, PartialOrd, Ord
163 at Eq, PartialOrd, Ord 164 at Clone, Copy
164 at Clone, Copy 165 at Debug
165 at Debug 166 at Clone
166 at Clone 167 at Hash
167 at Hash 168 at PartialOrd
168 at PartialOrd 169 "#]],
169 "#]],
170 ) 170 )
171 } 171 }
172} 172}