aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/keyword.rs20
-rw-r--r--crates/ide_completion/src/render.rs34
2 files changed, 13 insertions, 41 deletions
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs
index ba13d3707..0fccbeccf 100644
--- a/crates/ide_completion/src/completions/keyword.rs
+++ b/crates/ide_completion/src/completions/keyword.rs
@@ -536,17 +536,11 @@ Some multi-line comment$0
536 fn test_completion_await_impls_future() { 536 fn test_completion_await_impls_future() {
537 check( 537 check(
538 r#" 538 r#"
539//- /main.rs crate:main deps:std 539//- minicore: future
540use std::future::*; 540use core::future::*;
541struct A {} 541struct A {}
542impl Future for A {} 542impl Future for A {}
543fn foo(a: A) { a.$0 } 543fn foo(a: A) { a.$0 }
544
545//- /std/lib.rs crate:std
546pub mod future {
547 #[lang = "future_trait"]
548 pub trait Future {}
549}
550"#, 544"#,
551 expect![[r#" 545 expect![[r#"
552 kw await expr.await 546 kw await expr.await
@@ -555,20 +549,12 @@ pub mod future {
555 549
556 check( 550 check(
557 r#" 551 r#"
558//- /main.rs crate:main deps:std 552//- minicore: future
559use std::future::*; 553use std::future::*;
560fn foo() { 554fn foo() {
561 let a = async {}; 555 let a = async {};
562 a.$0 556 a.$0
563} 557}
564
565//- /std/lib.rs crate:std
566pub mod future {
567 #[lang = "future_trait"]
568 pub trait Future {
569 type Output;
570 }
571}
572"#, 558"#,
573 expect![[r#" 559 expect![[r#"
574 kw await expr.await 560 kw await expr.await
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index add296124..70bf26cf4 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -1149,16 +1149,11 @@ fn main() {
1149 fn suggest_deref() { 1149 fn suggest_deref() {
1150 check_relevance( 1150 check_relevance(
1151 r#" 1151 r#"
1152#[lang = "deref"] 1152//- minicore: deref
1153trait Deref {
1154 type Target;
1155 fn deref(&self) -> &Self::Target;
1156}
1157
1158struct S; 1153struct S;
1159struct T(S); 1154struct T(S);
1160 1155
1161impl Deref for T { 1156impl core::ops::Deref for T {
1162 type Target = S; 1157 type Target = S;
1163 1158
1164 fn deref(&self) -> &Self::Target { 1159 fn deref(&self) -> &Self::Target {
@@ -1182,8 +1177,9 @@ fn main() {
1182 st T [] 1177 st T []
1183 st S [] 1178 st S []
1184 fn main() [] 1179 fn main() []
1185 tt Deref []
1186 fn foo(…) [] 1180 fn foo(…) []
1181 md core []
1182 tt Sized []
1187 "#]], 1183 "#]],
1188 ) 1184 )
1189 } 1185 }
@@ -1192,21 +1188,11 @@ fn main() {
1192 fn suggest_deref_mut() { 1188 fn suggest_deref_mut() {
1193 check_relevance( 1189 check_relevance(
1194 r#" 1190 r#"
1195#[lang = "deref"] 1191//- minicore: deref_mut
1196trait Deref {
1197 type Target;
1198 fn deref(&self) -> &Self::Target;
1199}
1200
1201#[lang = "deref_mut"]
1202pub trait DerefMut: Deref {
1203 fn deref_mut(&mut self) -> &mut Self::Target;
1204}
1205
1206struct S; 1192struct S;
1207struct T(S); 1193struct T(S);
1208 1194
1209impl Deref for T { 1195impl core::ops::Deref for T {
1210 type Target = S; 1196 type Target = S;
1211 1197
1212 fn deref(&self) -> &Self::Target { 1198 fn deref(&self) -> &Self::Target {
@@ -1214,7 +1200,7 @@ impl Deref for T {
1214 } 1200 }
1215} 1201}
1216 1202
1217impl DerefMut for T { 1203impl core::ops::DerefMut for T {
1218 fn deref_mut(&mut self) -> &mut Self::Target { 1204 fn deref_mut(&mut self) -> &mut Self::Target {
1219 &mut self.0 1205 &mut self.0
1220 } 1206 }
@@ -1233,12 +1219,12 @@ fn main() {
1233 lc m [local] 1219 lc m [local]
1234 lc t [local] 1220 lc t [local]
1235 lc &mut t [type+local] 1221 lc &mut t [type+local]
1236 tt DerefMut []
1237 tt Deref []
1238 fn foo(…) []
1239 st T [] 1222 st T []
1240 st S [] 1223 st S []
1241 fn main() [] 1224 fn main() []
1225 fn foo(…) []
1226 md core []
1227 tt Sized []
1242 "#]], 1228 "#]],
1243 ) 1229 )
1244 } 1230 }