@@ -29,8 +29,8 @@ impl IntoIterator for CompletionsResult {
29
29
}
30
30
}
31
31
32
- pub ( crate ) fn get_statement_for_completions < ' a > (
33
- doc : & ' a ParsedDocument ,
32
+ pub ( crate ) fn get_statement_for_completions (
33
+ doc : & ParsedDocument ,
34
34
position : TextSize ,
35
35
) -> Option < ( StatementId , TextRange , String , Arc < tree_sitter:: Tree > ) > {
36
36
let count = doc. count ( ) ;
@@ -89,7 +89,7 @@ mod tests {
89
89
(
90
90
ParsedDocument :: new (
91
91
PgTPath :: new ( "test.sql" ) ,
92
- sql. replace ( CURSOR_POSITION , "" ) . into ( ) ,
92
+ sql. replace ( CURSOR_POSITION , "" ) ,
93
93
5 ,
94
94
) ,
95
95
TextSize :: new ( pos) ,
@@ -119,14 +119,11 @@ mod tests {
119
119
120
120
#[ test]
121
121
fn does_not_break_when_no_statements_exist ( ) {
122
- let sql = format ! ( "{}" , CURSOR_POSITION ) ;
122
+ let sql = CURSOR_POSITION . to_string ( ) ;
123
123
124
124
let ( doc, position) = get_doc_and_pos ( sql. as_str ( ) ) ;
125
125
126
- assert ! ( matches!(
127
- get_statement_for_completions( & doc, position) ,
128
- None
129
- ) ) ;
126
+ assert ! ( get_statement_for_completions( & doc, position) . is_none( ) ) ;
130
127
}
131
128
132
129
#[ test]
@@ -138,10 +135,7 @@ mod tests {
138
135
// make sure these are parsed as two
139
136
assert_eq ! ( doc. count( ) , 2 ) ;
140
137
141
- assert ! ( matches!(
142
- get_statement_for_completions( & doc, position) ,
143
- None
144
- ) ) ;
138
+ assert ! ( get_statement_for_completions( & doc, position) . is_none( ) ) ;
145
139
}
146
140
147
141
#[ test]
@@ -174,10 +168,7 @@ mod tests {
174
168
175
169
let ( doc, position) = get_doc_and_pos ( sql. as_str ( ) ) ;
176
170
177
- assert ! ( matches!(
178
- get_statement_for_completions( & doc, position) ,
179
- None
180
- ) ) ;
171
+ assert ! ( get_statement_for_completions( & doc, position) . is_none( ) ) ;
181
172
}
182
173
183
174
#[ test]
@@ -186,9 +177,6 @@ mod tests {
186
177
187
178
let ( doc, position) = get_doc_and_pos ( sql. as_str ( ) ) ;
188
179
189
- assert ! ( matches!(
190
- get_statement_for_completions( & doc, position) ,
191
- None
192
- ) ) ;
180
+ assert ! ( get_statement_for_completions( & doc, position) . is_none( ) ) ;
193
181
}
194
182
}
0 commit comments