Skip to content

Commit 1f58472

Browse files
readied
1 parent 77aea58 commit 1f58472

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

crates/pgls_completions/src/relevance/scoring.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ impl CompletionScore<'_> {
8787
WrappingClause::Delete => 10,
8888
WrappingClause::From => 5,
8989
WrappingClause::Join { on_node }
90-
if on_node.is_none_or(|on| ctx.node_under_cursor.end_byte() < on.start_byte()) =>
90+
if on_node
91+
.is_none_or(|on| ctx.node_under_cursor.end_byte() < on.start_byte()) =>
9192
{
9293
5
9394
}
@@ -106,7 +107,8 @@ impl CompletionScore<'_> {
106107
WrappingClause::Where => 10,
107108
WrappingClause::CheckOrUsingClause => 0,
108109
WrappingClause::Join { on_node }
109-
if on_node.is_some_and(|on| ctx.node_under_cursor.start_byte() > on.end_byte()) =>
110+
if on_node
111+
.is_some_and(|on| ctx.node_under_cursor.start_byte() > on.end_byte()) =>
110112
{
111113
// Users will probably join on primary keys
112114
if col.is_primary_key { 20 } else { 10 }

crates/pgls_completions/src/test_helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub(crate) async fn assert_no_complete_results(query: &str, setup: Option<&str>,
199199
let params = get_test_params(&tree, &cache, query.into());
200200
let items = complete(params);
201201

202-
println!("{:#?}", items);
202+
println!("{items:#?}");
203203

204204
assert_eq!(items.len(), 0)
205205
}

crates/pgls_treesitter/src/context/ancestors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub struct Scope {
33
pub ancestors: AncestorTracker,
44
}
55

6-
static SCOPE_BOUNDARIES: &[&'static str] = &["statement", "ERROR", "program"];
6+
static SCOPE_BOUNDARIES: &[&str] = &["statement", "ERROR", "program"];
77

88
#[derive(Debug)]
99
pub struct ScopeTracker {
@@ -22,7 +22,7 @@ impl ScopeTracker {
2222

2323
self.scopes
2424
.last_mut()
25-
.expect(format!("Unhandled node kind: {}", node.kind()).as_str())
25+
.unwrap_or_else(|| panic!("Unhandled node kind: {}", node.kind()))
2626
.ancestors
2727
.register(node, position);
2828
}
@@ -86,7 +86,7 @@ impl AncestorTracker {
8686
}
8787

8888
pub fn history_ends_with(&self, matchers: &[&'static str]) -> bool {
89-
assert!(matchers.len() > 0);
89+
assert!(!matchers.is_empty());
9090

9191
let mut tracking_idx = matchers.len() - 1;
9292

0 commit comments

Comments
 (0)