diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-20 17:38:46 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-20 17:38:46 +0100 |
commit | 8cc2b710db6ea851f0c4b636172861df98ba5ead (patch) | |
tree | 040844f1a7cbd829586a883e292f3fa5f090e3cb /crates/ide_completion/src/render.rs | |
parent | f1097c2d26b68741612ecd3411fe41dc13fb005a (diff) | |
parent | 9a3eae8755f99f4cfb8c2abb0885ec500b946218 (diff) |
Merge #9345
9345: fix: don't add duplicate `&` during completion r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/render.rs')
-rw-r--r-- | crates/ide_completion/src/render.rs | 75 |
1 files changed, 23 insertions, 52 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index 9bec03e17..1a9b6212a 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs | |||
@@ -1057,7 +1057,7 @@ fn f() { | |||
1057 | #[test] | 1057 | #[test] |
1058 | fn suggest_ref_mut() { | 1058 | fn suggest_ref_mut() { |
1059 | cov_mark::check!(suggest_ref); | 1059 | cov_mark::check!(suggest_ref); |
1060 | check( | 1060 | check_relevance( |
1061 | r#" | 1061 | r#" |
1062 | struct S; | 1062 | struct S; |
1063 | fn foo(s: &mut S) {} | 1063 | fn foo(s: &mut S) {} |
@@ -1067,58 +1067,29 @@ fn main() { | |||
1067 | } | 1067 | } |
1068 | "#, | 1068 | "#, |
1069 | expect![[r#" | 1069 | expect![[r#" |
1070 | [ | 1070 | lc s [name+local] |
1071 | CompletionItem { | 1071 | lc &mut s [type+name+local] |
1072 | label: "S", | 1072 | st S [] |
1073 | source_range: 70..70, | 1073 | fn main() [] |
1074 | delete: 70..70, | 1074 | fn foo(…) [] |
1075 | insert: "S", | ||
1076 | kind: SymbolKind( | ||
1077 | Struct, | ||
1078 | ), | ||
1079 | }, | ||
1080 | CompletionItem { | ||
1081 | label: "foo(…)", | ||
1082 | source_range: 70..70, | ||
1083 | delete: 70..70, | ||
1084 | insert: "foo(${1:&mut s})$0", | ||
1085 | kind: SymbolKind( | ||
1086 | Function, | ||
1087 | ), | ||
1088 | lookup: "foo", | ||
1089 | detail: "fn(&mut S)", | ||
1090 | trigger_call_info: true, | ||
1091 | }, | ||
1092 | CompletionItem { | ||
1093 | label: "main()", | ||
1094 | source_range: 70..70, | ||
1095 | delete: 70..70, | ||
1096 | insert: "main()$0", | ||
1097 | kind: SymbolKind( | ||
1098 | Function, | ||
1099 | ), | ||
1100 | lookup: "main", | ||
1101 | detail: "fn()", | ||
1102 | }, | ||
1103 | CompletionItem { | ||
1104 | label: "s", | ||
1105 | source_range: 70..70, | ||
1106 | delete: 70..70, | ||
1107 | insert: "s", | ||
1108 | kind: SymbolKind( | ||
1109 | Local, | ||
1110 | ), | ||
1111 | detail: "S", | ||
1112 | relevance: CompletionRelevance { | ||
1113 | exact_name_match: true, | ||
1114 | type_match: None, | ||
1115 | is_local: true, | ||
1116 | }, | ||
1117 | ref_match: "&mut ", | ||
1118 | }, | ||
1119 | ] | ||
1120 | "#]], | 1075 | "#]], |
1121 | ) | 1076 | ); |
1077 | check_relevance( | ||
1078 | r#" | ||
1079 | struct S; | ||
1080 | fn foo(s: &mut S) {} | ||
1081 | fn main() { | ||
1082 | let mut s = S; | ||
1083 | foo(&mut $0); | ||
1084 | } | ||
1085 | "#, | ||
1086 | expect![[r#" | ||
1087 | lc s [type+name+local] | ||
1088 | st S [] | ||
1089 | fn main() [] | ||
1090 | fn foo(…) [] | ||
1091 | "#]], | ||
1092 | ); | ||
1122 | } | 1093 | } |
1123 | 1094 | ||
1124 | #[test] | 1095 | #[test] |