Skip to content

Commit 20798d5

Browse files
fmt
1 parent 035682a commit 20798d5

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

pyrefly/lib/alt/call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
12011201
kws = x.arguments.keywords.map(CallKeyword::new);
12021202
}
12031203

1204-
self.distribute_over_union(&callee_ty, |ty| match ty.callee_kind() {
1204+
self.distribute_over_union(&callee_ty, |ty| match ty.callee_kind() {
12051205
Some(CalleeKind::Function(FunctionKind::AssertType)) => self
12061206
.call_assert_type(
12071207
&x.arguments.args,
@@ -1294,7 +1294,7 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
12941294
)
12951295
}
12961296
})
1297-
}
1297+
}
12981298
}
12991299

13001300
fn has_exactly_two_posargs(&self, arguments: &Arguments) -> bool {

pyrefly/lib/alt/callable.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,7 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
563563
if !self.type_contains_var(hint_ty) {
564564
use_hint = true;
565565
} else if let Type::Union(options) = hint_ty {
566-
if options
567-
.iter()
568-
.any(|option| !self.type_contains_var(option))
569-
{
566+
if options.iter().any(|option| !self.type_contains_var(option)) {
570567
use_hint = true;
571568
}
572569
}
@@ -616,10 +613,7 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
616613
if !self.type_contains_var(hint_ty) {
617614
use_hint = true;
618615
} else if let Type::Union(options) = hint_ty {
619-
if options
620-
.iter()
621-
.any(|option| !self.type_contains_var(option))
622-
{
616+
if options.iter().any(|option| !self.type_contains_var(option)) {
623617
use_hint = true;
624618
}
625619
}

pyrefly/lib/alt/expr.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ use ruff_python_ast::DictItem;
2828
use ruff_python_ast::Expr;
2929
use ruff_python_ast::ExprCall;
3030
use ruff_python_ast::ExprGenerator;
31-
use ruff_python_ast::ExprName;
3231
use ruff_python_ast::ExprLambda;
3332
use ruff_python_ast::ExprList;
33+
use ruff_python_ast::ExprName;
3434
use ruff_python_ast::ExprNumberLiteral;
3535
use ruff_python_ast::ExprStarred;
3636
use ruff_python_ast::ExprStringLiteral;
@@ -51,7 +51,6 @@ use crate::alt::callable::CallArg;
5151
use crate::alt::solve::TypeFormContext;
5252
use crate::alt::unwrap::Hint;
5353
use crate::alt::unwrap::HintRef;
54-
use crate::graph::index::Idx;
5554
use crate::binding::binding::Binding;
5655
use crate::binding::binding::Key;
5756
use crate::binding::binding::KeyYield;
@@ -61,6 +60,7 @@ use crate::error::collector::ErrorCollector;
6160
use crate::error::context::ErrorContext;
6261
use crate::error::context::ErrorInfo;
6362
use crate::error::context::TypeCheckContext;
63+
use crate::graph::index::Idx;
6464
use crate::types::callable::Callable;
6565
use crate::types::callable::Param;
6666
use crate::types::callable::ParamList;
@@ -330,8 +330,8 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
330330
.hint_from_type(branch.clone(), hint.errors())
331331
.with_source_branches(hint.source_branches());
332332
let branch_errors = self.error_collector();
333-
let info = self
334-
.expr_infer_type_info_with_hint(x, Some(branch_hint.as_ref()), &branch_errors);
333+
let info =
334+
self.expr_infer_type_info_with_hint(x, Some(branch_hint.as_ref()), &branch_errors);
335335
if branch_errors.is_empty() && self.is_subset_eq(info.ty(), branch) {
336336
errors.extend(branch_errors);
337337
return info;
@@ -1141,7 +1141,12 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
11411141
let param_vars: Vec<(Name, Var)> = if let Some(parameters) = &lambda.parameters {
11421142
parameters
11431143
.iter_non_variadic_params()
1144-
.map(|x| (x.name().id.clone(), self.bindings().get_lambda_param(x.name())))
1144+
.map(|x| {
1145+
(
1146+
x.name().id.clone(),
1147+
self.bindings().get_lambda_param(x.name()),
1148+
)
1149+
})
11451150
.collect()
11461151
} else {
11471152
Vec::new()

pyrefly/lib/solver/solver.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,7 @@ impl Solver {
336336
match &*variables.get(var) {
337337
Variable::Unwrap => UnwrapVarState::Unwrap,
338338
Variable::Answer(ty) => UnwrapVarState::Answer(ty.clone()),
339-
other => panic!(
340-
"Expected lambda parameter var to be Unwrap or Answer, got {other:?}"
341-
),
339+
other => panic!("Expected lambda parameter var to be Unwrap or Answer, got {other:?}"),
342340
}
343341
}
344342

0 commit comments

Comments
 (0)