Skip to content

Commit 230c69d

Browse files
committed
clippy
1 parent dae95a7 commit 230c69d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

crates/red_knot_python_semantic/src/semantic_index/expression.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ pub(crate) struct Expression<'db> {
5353
/// to the target, and so have `None` for this field.)
5454
#[no_eq]
5555
#[tracked]
56-
#[return_ref]
5756
pub(crate) assigned_to: Option<AstNodeRef<ast::StmtAssign>>,
5857

5958
/// Should this expression be inferred as a normal expression or a type expression?

crates/red_knot_python_semantic/src/types/infer.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4632,14 +4632,16 @@ impl<'db> TypeInferenceBuilder<'db> {
46324632
KnownClass::TypeVar => {
46334633
let assigned_to = (self.index)
46344634
.try_expression(call_expression_node)
4635-
.and_then(|expr| expr.assigned_to(self.db()).as_ref());
4635+
.and_then(|expr| expr.assigned_to(self.db()));
46364636

4637-
let Some(target) = assigned_to.and_then(|assigned_to| {
4638-
match assigned_to.node().targets.as_slice() {
4639-
[ast::Expr::Name(target)] => Some(target),
4640-
_ => None,
4641-
}
4642-
}) else {
4637+
let Some(target) =
4638+
assigned_to.as_ref().and_then(|assigned_to| {
4639+
match assigned_to.node().targets.as_slice() {
4640+
[ast::Expr::Name(target)] => Some(target),
4641+
_ => None,
4642+
}
4643+
})
4644+
else {
46434645
if let Some(builder) = self.context.report_lint(
46444646
&INVALID_LEGACY_TYPE_VARIABLE,
46454647
call_expression,
@@ -4660,8 +4662,7 @@ impl<'db> TypeInferenceBuilder<'db> {
46604662
let name_param = name_param
46614663
.into_string_literal()
46624664
.map(|name| name.value(self.db()).as_ref());
4663-
if !name_param.is_some_and(|name_param| name_param == target.id)
4664-
{
4665+
if name_param.is_none_or(|name_param| name_param != target.id) {
46654666
if let Some(builder) = self.context.report_lint(
46664667
&INVALID_LEGACY_TYPE_VARIABLE,
46674668
call_expression,

0 commit comments

Comments
 (0)