Skip to content

Commit 855d6db

Browse files
committed
Fix clippy suggestion
1 parent 2e2649a commit 855d6db

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

crates/red_knot_python_semantic/src/types.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,10 @@ impl<'db> Type<'db> {
17881788
if truthiness.is_always_true() {
17891789
CallOutcome::callable(binding)
17901790
} else {
1791-
CallOutcome::StaticAssertionError { ty, truthiness }
1791+
CallOutcome::StaticAssertionError {
1792+
argument_ty: ty,
1793+
truthiness,
1794+
}
17921795
}
17931796
}
17941797

crates/red_knot_python_semantic/src/types/call.rs

+17-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(super) enum CallOutcome<'db> {
3535
call_outcome: Box<CallOutcome<'db>>,
3636
},
3737
StaticAssertionError {
38-
ty: Type<'db>,
38+
argument_ty: Type<'db>,
3939
truthiness: Truthiness,
4040
},
4141
}
@@ -260,7 +260,7 @@ impl<'db> CallOutcome<'db> {
260260
}
261261
}
262262
CallOutcome::StaticAssertionError {
263-
ty: Type::BooleanLiteral(false),
263+
argument_ty: Type::BooleanLiteral(false),
264264
truthiness: _,
265265
} => {
266266
context.report_lint(
@@ -271,31 +271,38 @@ impl<'db> CallOutcome<'db> {
271271

272272
Ok(Type::Unknown)
273273
}
274-
CallOutcome::StaticAssertionError { ty, truthiness }
275-
if truthiness.is_always_false() =>
276-
{
274+
CallOutcome::StaticAssertionError {
275+
argument_ty,
276+
truthiness,
277+
} if truthiness.is_always_false() => {
277278
context.report_lint(
278279
&STATIC_ASSERT_ERROR,
279280
node,
280-
format_args!("Static assertion error: argument of type `{ty}` is statically known to be falsy", ty=ty.display(db)),
281+
format_args!("Static assertion error: argument of type `{argument_ty}` is statically known to be falsy", argument_ty=argument_ty.display(db)),
281282
);
282283

283284
Ok(Type::Unknown)
284285
}
285-
CallOutcome::StaticAssertionError { ty, truthiness } if truthiness.is_ambiguous() => {
286+
CallOutcome::StaticAssertionError {
287+
argument_ty,
288+
truthiness,
289+
} if truthiness.is_ambiguous() => {
286290
context.report_lint(
287291
&STATIC_ASSERT_ERROR,
288292
node,
289-
format_args!("Static assertion error: argument of type `{ty}` has an ambiguous static truthiness", ty=ty.display(db)),
293+
format_args!("Static assertion error: argument of type `{argument_ty}` has an ambiguous static truthiness", argument_ty=argument_ty.display(db)),
290294
);
291295

292296
Ok(Type::Unknown)
293297
}
294-
CallOutcome::StaticAssertionError { ty, truthiness: _ } => {
298+
CallOutcome::StaticAssertionError {
299+
argument_ty,
300+
truthiness: _,
301+
} => {
295302
context.report_lint(
296303
&STATIC_ASSERT_ERROR,
297304
node,
298-
format_args!("Static assertion error: expected argument of type `{ty}` to have static truthiness", ty=ty.display(db)),
305+
format_args!("Static assertion error: expected argument of type `{argument_ty}` to have static truthiness", argument_ty=argument_ty.display(db)),
299306
);
300307

301308
Ok(Type::Unknown)

crates/red_knot_python_semantic/src/types/infer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3052,7 +3052,7 @@ impl<'db> TypeInferenceBuilder<'db> {
30523052
let infer_arguments_as_type_expressions = function_type
30533053
.into_function_literal()
30543054
.and_then(|f| f.known(self.db()))
3055-
.is_some_and(|f| f.takes_type_expression_arguments());
3055+
.is_some_and(KnownFunction::takes_type_expression_arguments);
30563056

30573057
let call_arguments = self.infer_arguments(arguments, infer_arguments_as_type_expressions);
30583058
function_type

0 commit comments

Comments
 (0)