File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
pgls_treesitter/src/context Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ use crate::{
22 CompletionItemKind , CompletionText ,
33 item:: CompletionItem ,
44 relevance:: { filtering:: CompletionFilter , scoring:: CompletionScore } ,
5- sanitization,
65} ;
76
87use pgls_treesitter:: TreesitterContext ;
@@ -43,10 +42,7 @@ impl<'a> CompletionBuilder<'a> {
4342 item. score . calc_score ( self . ctx ) ;
4443 }
4544
46- items = items
47- . into_iter ( )
48- . filter ( |i| !i. score . should_skip ( ) )
49- . collect ( ) ;
45+ items. retain ( |i| !i. score . should_skip ( ) ) ;
5046
5147 items. sort_by ( |a, b| {
5248 b. score
Original file line number Diff line number Diff line change @@ -71,12 +71,12 @@ impl CompletionScore<'_> {
7171 ( None , Some ( qualifier) ) => {
7272 if self . get_schema_name ( ) . is_some_and ( |s| s == qualifier) {
7373 self . get_table_name ( )
74- . map ( |t| format ! ( "{}.{}" , t , name ) )
74+ . map ( |t| format ! ( "{t }.{name}" ) )
7575 . unwrap_or ( name. clone ( ) )
7676 } else if self . get_table_name ( ) . is_some_and ( |t| t == qualifier) {
7777 name. clone ( )
7878 } else if ctx
79- . get_mentioned_table_for_alias ( & qualifier)
79+ . get_mentioned_table_for_alias ( qualifier)
8080 . is_some_and ( |alias_tbl| {
8181 self . get_table_name ( )
8282 . is_some_and ( |item_tbl| alias_tbl == item_tbl)
@@ -97,7 +97,7 @@ impl CompletionScore<'_> {
9797 CompletionRelevanceData :: Column ( _) | CompletionRelevanceData :: Policy ( _) => self
9898 . get_table_name ( )
9999 . and_then ( |tbl| ctx. get_used_alias_for_table ( tbl) )
100- . map ( |t| format ! ( "{}.{}" , t , name ) )
100+ . map ( |t| format ! ( "{t }.{name}" ) )
101101 . unwrap_or ( name. clone ( ) ) ,
102102
103103 // everything else is just fuzzy matched against its name.
@@ -243,7 +243,7 @@ impl CompletionScore<'_> {
243243 _ => { }
244244 } ,
245245
246- _ => return ,
246+ _ => ( ) ,
247247 }
248248 }
249249
Original file line number Diff line number Diff line change @@ -1138,7 +1138,7 @@ mod tests {
11381138 for case in cases {
11391139 let params = TreeSitterContextParams {
11401140 position : case. cursor_position . into ( ) ,
1141- text : & query,
1141+ text : query,
11421142 tree : & tree,
11431143 } ;
11441144
You can’t perform that action at this time.
0 commit comments