diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide_assists/src/handlers/generate_deref.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/crates/ide_assists/src/handlers/generate_deref.rs b/crates/ide_assists/src/handlers/generate_deref.rs index 4998ff7a4..4e10fdb85 100644 --- a/crates/ide_assists/src/handlers/generate_deref.rs +++ b/crates/ide_assists/src/handlers/generate_deref.rs | |||
@@ -182,23 +182,17 @@ impl std::ops::Deref for B { | |||
182 | ); | 182 | ); |
183 | } | 183 | } |
184 | 184 | ||
185 | fn check_not_applicable(ra_fixture: &str) { | ||
186 | let fixture = format!( | ||
187 | "//- /main.rs crate:main deps:core,std\n{}\n{}", | ||
188 | ra_fixture, | ||
189 | FamousDefs::FIXTURE | ||
190 | ); | ||
191 | check_assist_not_applicable(generate_deref, &fixture) | ||
192 | } | ||
193 | |||
194 | #[test] | 185 | #[test] |
195 | fn test_generate_record_deref_not_applicable_if_already_impl() { | 186 | fn test_generate_record_deref_not_applicable_if_already_impl() { |
196 | cov_mark::check!(test_add_record_deref_impl_already_exists); | 187 | cov_mark::check!(test_add_record_deref_impl_already_exists); |
197 | check_not_applicable( | 188 | check_assist_not_applicable( |
198 | r#"struct A { } | 189 | generate_deref, |
190 | r#" | ||
191 | //- minicore: deref | ||
192 | struct A { } | ||
199 | struct B { $0a: A } | 193 | struct B { $0a: A } |
200 | 194 | ||
201 | impl std::ops::Deref for B { | 195 | impl core::ops::Deref for B { |
202 | type Target = A; | 196 | type Target = A; |
203 | 197 | ||
204 | fn deref(&self) -> &Self::Target { | 198 | fn deref(&self) -> &Self::Target { |
@@ -211,11 +205,14 @@ impl std::ops::Deref for B { | |||
211 | #[test] | 205 | #[test] |
212 | fn test_generate_field_deref_not_applicable_if_already_impl() { | 206 | fn test_generate_field_deref_not_applicable_if_already_impl() { |
213 | cov_mark::check!(test_add_field_deref_impl_already_exists); | 207 | cov_mark::check!(test_add_field_deref_impl_already_exists); |
214 | check_not_applicable( | 208 | check_assist_not_applicable( |
215 | r#"struct A { } | 209 | generate_deref, |
210 | r#" | ||
211 | //- minicore: deref | ||
212 | struct A { } | ||
216 | struct B($0A) | 213 | struct B($0A) |
217 | 214 | ||
218 | impl std::ops::Deref for B { | 215 | impl core::ops::Deref for B { |
219 | type Target = A; | 216 | type Target = A; |
220 | 217 | ||
221 | fn deref(&self) -> &Self::Target { | 218 | fn deref(&self) -> &Self::Target { |