Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/render.rs')
-rw-r--r--crates/ide-completion/src/render.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs
index c0f09e1d95..aa9b05ecff 100644
--- a/crates/ide-completion/src/render.rs
+++ b/crates/ide-completion/src/render.rs
@@ -3240,6 +3240,48 @@ impl S {
}
#[test]
+ fn field_access_includes_closure_this_param() {
+ check_edit(
+ "length",
+ r#"
+//- minicore: fn
+struct S {
+ length: i32
+}
+
+impl S {
+ fn pack(&mut self, f: impl FnOnce(&mut Self, i32)) {
+ self.length += 1;
+ f(self, 3);
+ self.length -= 1;
+ }
+
+ fn some_fn(&mut self) {
+ self.pack(|this, n| len$0);
+ }
+}
+"#,
+ r#"
+struct S {
+ length: i32
+}
+
+impl S {
+ fn pack(&mut self, f: impl FnOnce(&mut Self, i32)) {
+ self.length += 1;
+ f(self, 3);
+ self.length -= 1;
+ }
+
+ fn some_fn(&mut self) {
+ self.pack(|this, n| this.length);
+ }
+}
+"#,
+ )
+ }
+
+ #[test]
fn notable_traits_method_relevance() {
check_kinds(
r#"