Skip to content

Commit 0ed8cde

Browse files
committed
style: rustfmt
Signed-off-by: Andrey <andrekabatareika@gmail.com>
1 parent 5e8cc39 commit 0ed8cde

4 files changed

Lines changed: 36 additions & 9 deletions

File tree

compiler-core/src/error.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use crate::strings::{to_snake_case, to_upper_camel_case};
1010
use crate::type_::collapse_links;
1111
use crate::type_::error::{
1212
IncorrectArityContext, InvalidImportKind, MissingAnnotation, ModuleValueUsageContext, Named,
13-
RecordField, UnexpectedLabelledArgKind, UnknownField, UnknownTypeHint, UnsafeRecordUpdateReason,
13+
RecordField, UnexpectedLabelledArgKind, UnknownField, UnknownTypeHint,
14+
UnsafeRecordUpdateReason,
1415
};
1516
use crate::type_::printer::{Names, Printer};
1617
use crate::type_::{FieldAccessUsage, error::PatternMatchKind};
@@ -1769,10 +1770,16 @@ constructor accepts."
17691770
}
17701771
}
17711772

1772-
TypeError::UnexpectedLabelledArg { location, label, kind } => {
1773+
TypeError::UnexpectedLabelledArg {
1774+
location,
1775+
label,
1776+
kind,
1777+
} => {
17731778
let kind = match kind {
17741779
UnexpectedLabelledArgKind::FunctionParameter => "function",
1775-
UnexpectedLabelledArgKind::RecordConstructorArgument => "record constructor",
1780+
UnexpectedLabelledArgKind::RecordConstructorArgument => {
1781+
"record constructor"
1782+
}
17761783
};
17771784
let text = format!(
17781785
"This argument has been given a label but the {kind} does

compiler-core/src/type_.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,10 @@ impl ValueConstructor {
15241524

15251525
pub type TypedCallArg = CallArg<TypedExpr>;
15261526

1527-
fn assert_no_labelled_arguments<A>(arguments: &[CallArg<A>], kind: UnexpectedLabelledArgKind) -> Result<(), Error> {
1527+
fn assert_no_labelled_arguments<A>(
1528+
arguments: &[CallArg<A>],
1529+
kind: UnexpectedLabelledArgKind,
1530+
) -> Result<(), Error> {
15281531
for argument in arguments {
15291532
if let Some(label) = &argument.label {
15301533
return Err(Error::UnexpectedLabelledArg {

compiler-core/src/type_/expression.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,8 +4144,16 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
41444144
}
41454145
// The fun or constructor has no field map and so we error
41464146
// if arguments have been labelled.
4147-
Ok(None) if fun.is_record_constructor_function() => assert_no_labelled_arguments(&arguments, UnexpectedLabelledArgKind::RecordConstructorArgument),
4148-
Ok(None) => assert_no_labelled_arguments(&arguments, UnexpectedLabelledArgKind::FunctionParameter),
4147+
Ok(None) if fun.is_record_constructor_function() => {
4148+
assert_no_labelled_arguments(
4149+
&arguments,
4150+
UnexpectedLabelledArgKind::RecordConstructorArgument,
4151+
)
4152+
}
4153+
Ok(None) => assert_no_labelled_arguments(
4154+
&arguments,
4155+
UnexpectedLabelledArgKind::FunctionParameter,
4156+
),
41494157
};
41504158

41514159
// If there's an error reordering the fields, or there's labelled
@@ -4542,8 +4550,14 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
45424550
// known to be a valid function we can make sure that there's
45434551
// no labelled arguments if it doesn't actually have a field map.
45444552
None if fun.is_invalid() => Ok(()),
4545-
None if fun.is_record_constructor_function() => assert_no_labelled_arguments(&arguments, UnexpectedLabelledArgKind::RecordConstructorArgument),
4546-
None => assert_no_labelled_arguments(&arguments, UnexpectedLabelledArgKind::FunctionParameter),
4553+
None if fun.is_record_constructor_function() => assert_no_labelled_arguments(
4554+
&arguments,
4555+
UnexpectedLabelledArgKind::RecordConstructorArgument,
4556+
),
4557+
None => assert_no_labelled_arguments(
4558+
&arguments,
4559+
UnexpectedLabelledArgKind::FunctionParameter,
4560+
),
45474561
}
45484562
});
45494563

compiler-core/src/type_/pattern.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,10 @@ impl<'a, 'b> PatternTyper<'a, 'b> {
11011101
None => {
11021102
// The fun or constructor has no field map and so we
11031103
// error if arguments have been labelled
1104-
match assert_no_labelled_arguments(&pattern_arguments, UnexpectedLabelledArgKind::RecordConstructorArgument) {
1104+
match assert_no_labelled_arguments(
1105+
&pattern_arguments,
1106+
UnexpectedLabelledArgKind::RecordConstructorArgument,
1107+
) {
11051108
Ok(()) => {}
11061109
Err(error) => {
11071110
self.problems.error(error);

0 commit comments

Comments
 (0)