Skip to content

Commit 3e44a75

Browse files
clippy
1 parent a2a589b commit 3e44a75

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pyrefly/lib/state/ide.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ pub fn insert_import_edit_with_forced_import_format(
254254
module_name_to_import.as_str(),
255255
export_name
256256
);
257-
if merge_with_existing {
258-
if let Some(edit) = try_extend_existing_from_import(
257+
if merge_with_existing
258+
&& let Some(edit) = try_extend_existing_from_import(
259259
ast,
260260
module_name_to_import.as_str(),
261261
export_name,
@@ -264,7 +264,6 @@ pub fn insert_import_edit_with_forced_import_format(
264264
) {
265265
return edit;
266266
}
267-
}
268267
let position = if let Some(first_stmt) = ast.body.iter().find(|stmt| !is_docstring_stmt(stmt)) {
269268
first_stmt.range().start()
270269
} else {
@@ -313,8 +312,8 @@ fn try_extend_existing_from_import(
313312
module_name: &str,
314313
) -> Option<ImportEdit> {
315314
for stmt in &ast.body {
316-
if let Stmt::ImportFrom(import_from) = stmt {
317-
if import_from_module_name(import_from) == target_module_name {
315+
if let Stmt::ImportFrom(import_from) = stmt
316+
&& import_from_module_name(import_from) == target_module_name {
318317
if import_from
319318
.names
320319
.iter()
@@ -334,7 +333,6 @@ fn try_extend_existing_from_import(
334333
});
335334
}
336335
}
337-
}
338336
}
339337
None
340338
}

pyrefly/lib/state/lsp.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,10 +2872,12 @@ impl<'a> Transaction<'a> {
28722872
}
28732873
self.add_literal_completions(handle, position, &mut result);
28742874
// Only offer kwargs when the cursor isn't inside a literal value.
2875-
if !nodes.iter().any(|n| matches!(n, AnyNodeRef::ExprStringLiteral(_)))
2876-
&& nodes
2877-
.iter()
2878-
.any(|n| matches!(n, AnyNodeRef::ExprCall(_) | AnyNodeRef::Arguments(_)))
2875+
if !nodes
2876+
.iter()
2877+
.any(|n| matches!(n, AnyNodeRef::ExprStringLiteral(_)))
2878+
&& nodes.iter().any(|n| {
2879+
matches!(n, AnyNodeRef::ExprCall(_) | AnyNodeRef::Arguments(_))
2880+
})
28792881
{
28802882
self.add_kwargs_completions(handle, position, &mut result);
28812883
}

0 commit comments

Comments
 (0)