Skip to content

Commit 3b6b011

Browse files
.
1 parent 09b6e56 commit 3b6b011

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pyrefly/lib/state/lsp/endpoint_support.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl EndpointMethod {
7171
Self::from_attr(value)
7272
}
7373

74-
fn as_str(&self) -> &'static str {
74+
fn as_str(self) -> &'static str {
7575
match self {
7676
Self::Get => "GET",
7777
Self::Post => "POST",
@@ -200,8 +200,9 @@ fn endpoint_methods_from_call(call: &ExprCall) -> Option<Vec<EndpointMethod>> {
200200

201201
fn methods_from_expr(expr: &Expr) -> Option<Vec<EndpointMethod>> {
202202
match expr {
203-
Expr::StringLiteral(lit) => EndpointMethod::from_literal(&lit.value.to_string())
204-
.map(|method| vec![method]),
203+
Expr::StringLiteral(lit) => {
204+
EndpointMethod::from_literal(&lit.value.to_string()).map(|method| vec![method])
205+
}
205206
Expr::List(ExprList { elts, .. })
206207
| Expr::Tuple(ExprTuple { elts, .. })
207208
| Expr::Set(ExprSet { elts, .. }) => {
@@ -429,9 +430,9 @@ impl<'a> Transaction<'a> {
429430
if !prefix.is_empty() && !endpoint.path.starts_with(&prefix) {
430431
continue;
431432
}
432-
suggestions.entry(endpoint.path).or_insert_with(|| {
433-
format!("{} endpoint", context.method.as_str())
434-
});
433+
suggestions
434+
.entry(endpoint.path)
435+
.or_insert_with(|| format!("{} endpoint", context.method.as_str()));
435436
}
436437
if suggestions.is_empty() {
437438
return;

pyrefly/lib/test/lsp/definition.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ client = TestClient(app)
7575
client.get("/users")
7676
# ^
7777
"#;
78-
let report =
79-
get_batched_lsp_operations_report_allow_error(&[("main", code)], get_test_report);
80-
let def_start = code.find("list_users").expect("expected list_users definition");
78+
let report = get_batched_lsp_operations_report_allow_error(&[("main", code)], get_test_report);
79+
let def_start = code
80+
.find("list_users")
81+
.expect("expected list_users definition");
8182
let def_end = def_start + "list_users".len();
8283
let expected = format!(
8384
"Definition Result:\n{}",

0 commit comments

Comments
 (0)