Skip to content

Commit 849b6e2

Browse files
committed
From<DataclassTransformerParams> for DataclassParams
1 parent 06e3ae3 commit 849b6e2

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

crates/red_knot_python_semantic/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ impl Default for DataclassParams {
364364
}
365365
}
366366

367-
impl DataclassParams {
368-
fn from_transformer_params(params: DataclassTransformerParams) -> Self {
367+
impl From<DataclassTransformerParams> for DataclassParams {
368+
fn from(params: DataclassTransformerParams) -> Self {
369369
let mut result = Self::default();
370370

371371
result.set(

crates/red_knot_python_semantic/src/types/call/bind.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,7 @@ impl<'db> Bindings<'db> {
690690
// the argument type and overwrite the corresponding flag in `dataclass_params` after
691691
// constructing them from the `dataclass_transformer`-parameter defaults.
692692

693-
let mut dataclass_params =
694-
DataclassParams::from_transformer_params(params);
693+
let mut dataclass_params = DataclassParams::from(params);
695694

696695
if let Some(Some(Type::BooleanLiteral(order))) = callable_signature
697696
.iter()

crates/red_knot_python_semantic/src/types/infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ impl<'db> TypeInferenceBuilder<'db> {
17801780

17811781
if let Type::FunctionLiteral(f) = decorator_ty {
17821782
if let Some(params) = f.dataclass_transformer_params(self.db()) {
1783-
dataclass_params = Some(DataclassParams::from_transformer_params(params));
1783+
dataclass_params = Some(params.into());
17841784
continue;
17851785
}
17861786
}

0 commit comments

Comments
 (0)