Skip to content

Commit 2ccd1d4

Browse files
committed
refactor(formatter): remove useless space()
1 parent 7ca6162 commit 2ccd1d4

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

crates/oxc_formatter/src/utils/assignment_like.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ impl<'a> AssignmentLike<'a, '_> {
322322
}
323323
Self::ObjectProperty(property) => {
324324
debug_assert!(!property.shorthand);
325-
write!(f, [":", space()]);
325+
write!(f, [":"]);
326326
}
327327
Self::BindingProperty(property) => {
328328
if !property.shorthand {
329-
write!(f, [":", space()]);
329+
write!(f, [":"]);
330330
}
331331
}
332332
Self::PropertyDefinition(property_class_member) => {
@@ -342,14 +342,11 @@ impl<'a> AssignmentLike<'a, '_> {
342342
fn write_right(&self, f: &mut Formatter<'_, 'a>, layout: AssignmentLikeLayout) {
343343
match self {
344344
Self::VariableDeclarator(declarator) => {
345-
write!(
346-
f,
347-
[space(), with_assignment_layout(declarator.init().unwrap(), Some(layout))]
348-
);
345+
write!(f, [with_assignment_layout(declarator.init().unwrap(), Some(layout))]);
349346
}
350347
Self::AssignmentExpression(assignment) => {
351348
let right = assignment.right();
352-
write!(f, [space(), with_assignment_layout(right, Some(layout))]);
349+
write!(f, [with_assignment_layout(right, Some(layout))]);
353350
}
354351
Self::ObjectProperty(property) => {
355352
let value = property.value();
@@ -359,17 +356,14 @@ impl<'a> AssignmentLike<'a, '_> {
359356
write!(f, property.value());
360357
}
361358
Self::PropertyDefinition(property) => {
362-
write!(
363-
f,
364-
[space(), with_assignment_layout(property.value().unwrap(), Some(layout))]
365-
);
359+
write!(f, [with_assignment_layout(property.value().unwrap(), Some(layout))]);
366360
}
367361
Self::TSTypeAliasDeclaration(declaration) => {
368362
if let AstNodes::TSUnionType(union) = declaration.type_annotation().as_ast_nodes() {
369363
union.write(f);
370364
union.format_trailing_comments(f);
371365
} else {
372-
write!(f, [space(), declaration.type_annotation()]);
366+
write!(f, [declaration.type_annotation()]);
373367
}
374368
}
375369
}

0 commit comments

Comments
 (0)