Skip to content

Commit 1b60f1d

Browse files
committed
fix fmt
1 parent bfde01a commit 1b60f1d

File tree

9 files changed

+64
-33
lines changed

9 files changed

+64
-33
lines changed

crates/ast_node/src/encoding/decode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ pub fn expand(DeriveInput { ident, data, .. }: DeriveInput) -> syn::ItemImpl {
229229
};
230230

231231
let tag: syn::Stmt = if matches!(enum_type, EnumType::Unit) {
232-
syn::parse_quote!{
232+
syn::parse_quote! {
233233
let tag = <u64 as cbor4ii::core::dec::Decode<'_>>::decode(reader)?;
234234
}
235235
} else {
236-
syn::parse_quote!{
236+
syn::parse_quote! {
237237
let tag = <cbor4ii::core::types::Tag<()>>::tag(reader)?;
238238
}
239239
};

crates/swc_common/src/serializer.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ pub struct ArrayOption<T>(pub T);
4949

5050
#[cfg(feature = "encoding-impl")]
5151
impl<T: cbor4ii::core::enc::Encode> cbor4ii::core::enc::Encode for ArrayOption<&'_ Vec<Option<T>>> {
52-
fn encode<W: cbor4ii::core::enc::Write>(&self, writer: &mut W) -> Result<(), cbor4ii::core::enc::Error<W::Error>> {
52+
fn encode<W: cbor4ii::core::enc::Write>(
53+
&self,
54+
writer: &mut W,
55+
) -> Result<(), cbor4ii::core::enc::Error<W::Error>> {
5356
<cbor4ii::core::types::Array<()>>::bounded(self.0.len(), writer)?;
5457
for item in self.0.iter() {
5558
cbor4ii::core::types::Maybe(item).encode(writer)?;
@@ -59,13 +62,19 @@ impl<T: cbor4ii::core::enc::Encode> cbor4ii::core::enc::Encode for ArrayOption<&
5962
}
6063

6164
#[cfg(feature = "encoding-impl")]
62-
impl<'de, T: cbor4ii::core::dec::Decode<'de>> cbor4ii::core::dec::Decode<'de> for ArrayOption<Vec<Option<T>>> {
63-
fn decode<R: cbor4ii::core::dec::Read<'de>>(reader: &mut R) -> Result<Self, cbor4ii::core::dec::Error<R::Error>> {
65+
impl<'de, T: cbor4ii::core::dec::Decode<'de>> cbor4ii::core::dec::Decode<'de>
66+
for ArrayOption<Vec<Option<T>>>
67+
{
68+
fn decode<R: cbor4ii::core::dec::Read<'de>>(
69+
reader: &mut R,
70+
) -> Result<Self, cbor4ii::core::dec::Error<R::Error>> {
6471
let len = <cbor4ii::core::types::Array<()>>::len(reader)?;
6572
let Some(len) = len else {
6673
return Err(cbor4ii::core::error::DecodeError::RequireLength {
6774
name: &"array-option",
68-
found: len.map(cbor4ii::core::error::Len::new).unwrap_or(cbor4ii::core::error::Len::Indefinite),
75+
found: len
76+
.map(cbor4ii::core::error::Len::new)
77+
.unwrap_or(cbor4ii::core::error::Len::Indefinite),
6978
});
7079
};
7180
let mut q = Vec::with_capacity(std::cmp::min(len, 128));

crates/swc_common/src/unknown.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ impl<'de> serde::Deserialize<'de> for Unknown {
119119
#[cfg(feature = "arbitrary")]
120120
impl<'a> arbitrary::Arbitrary<'a> for Unknown {
121121
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
122-
use cbor4ii::core::{ Value, BoxedRawValue };
123-
122+
use cbor4ii::core::{BoxedRawValue, Value};
123+
124124
let len = u.arbitrary_len::<u64>()?;
125125
let mut list = Vec::new();
126126
for _ in 0..len() {
127127
let n = u.int_in_range::<u64>(0..=102410241024)?;
128128
list.push(Value::Integer(n.into()));
129129
}
130130
let value = Value::Array(list);
131-
let value = BoxedRawValue::from_value(&value)
132-
.map_err(|_| arbitrary::Error::IncorrectFormat)?;
131+
let value =
132+
BoxedRawValue::from_value(&value).map_err(|_| arbitrary::Error::IncorrectFormat)?;
133133
Ok(Unknown(value))
134134
}
135135
}

crates/swc_css_lints/src/rules/unit_no_unknown.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ impl Visit for UnitNoUnknown {
5252
fn visit_component_value(&mut self, component_value: &ComponentValue) {
5353
if let Some(token_and_span) = component_value.as_preserved_token() {
5454
if let Some(unit) = match &token_and_span.token {
55-
Token::Dimension { dimension: dimension_token } => Some(dimension_token.unit.as_ref()),
55+
Token::Dimension {
56+
dimension: dimension_token,
57+
} => Some(dimension_token.unit.as_ref()),
5658
_ => None,
5759
} {
5860
if self.ignored_units.iter().all(|item| !item.is_match(unit)) {

crates/swc_css_minifier/src/compressor/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,9 @@ impl VisitMut for Compressor {
462462
Token::BadUrl { raw: value, .. } if !contains_only_ascii_characters(value) => {
463463
self.need_utf8_at_rule = true;
464464
}
465-
Token::Dimension { dimension: dimension_token }
466-
if !contains_only_ascii_characters(&dimension_token.unit) =>
467-
{
465+
Token::Dimension {
466+
dimension: dimension_token,
467+
} if !contains_only_ascii_characters(&dimension_token.unit) => {
468468
self.need_utf8_at_rule = true;
469469
}
470470
_ => {}

crates/swc_css_parser/src/parser/values_and_units/mod.rs

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,9 @@ where
19641964
}
19651965

19661966
match cur!(self) {
1967-
Token::Dimension { dimension: dimension_token } => {
1967+
Token::Dimension {
1968+
dimension: dimension_token,
1969+
} => {
19681970
match &dimension_token.unit {
19691971
// <length>
19701972
unit if is_length_unit(unit)
@@ -2004,7 +2006,9 @@ where
20042006
}
20052007

20062008
match bump!(self) {
2007-
Token::Dimension { dimension: dimension_token } => {
2009+
Token::Dimension {
2010+
dimension: dimension_token,
2011+
} => {
20082012
let DimensionToken {
20092013
value,
20102014
unit,
@@ -2050,7 +2054,9 @@ where
20502054
}
20512055

20522056
match bump!(self) {
2053-
Token::Dimension { dimension: dimension_token } => {
2057+
Token::Dimension {
2058+
dimension: dimension_token,
2059+
} => {
20542060
let DimensionToken {
20552061
value,
20562062
unit,
@@ -2101,7 +2107,9 @@ where
21012107
}
21022108

21032109
match bump!(self) {
2104-
Token::Dimension { dimension: dimension_token } => {
2110+
Token::Dimension {
2111+
dimension: dimension_token,
2112+
} => {
21052113
let DimensionToken {
21062114
value,
21072115
unit,
@@ -2149,7 +2157,9 @@ where
21492157
}
21502158

21512159
match bump!(self) {
2152-
Token::Dimension { dimension: dimension_token } => {
2160+
Token::Dimension {
2161+
dimension: dimension_token,
2162+
} => {
21532163
let DimensionToken {
21542164
value,
21552165
unit,
@@ -2197,7 +2207,9 @@ where
21972207
}
21982208

21992209
match bump!(self) {
2200-
Token::Dimension { dimension: dimension_token } => {
2210+
Token::Dimension {
2211+
dimension: dimension_token,
2212+
} => {
22012213
let DimensionToken {
22022214
value,
22032215
unit,
@@ -2248,7 +2260,9 @@ where
22482260
}
22492261

22502262
match bump!(self) {
2251-
Token::Dimension { dimension: dimension_token } => {
2263+
Token::Dimension {
2264+
dimension: dimension_token,
2265+
} => {
22522266
let DimensionToken {
22532267
value,
22542268
unit,
@@ -2296,7 +2310,9 @@ where
22962310
}
22972311

22982312
match bump!(self) {
2299-
Token::Dimension { dimension: dimension_token } => {
2313+
Token::Dimension {
2314+
dimension: dimension_token,
2315+
} => {
23002316
let DimensionToken {
23012317
value,
23022318
unit,
@@ -2805,9 +2821,9 @@ where
28052821
}
28062822
tok!("dimension") => {
28072823
let raw = match bump!(self) {
2808-
Token::Dimension { dimension: dimension_token } => {
2809-
(dimension_token.raw_value, dimension_token.raw_unit)
2810-
}
2824+
Token::Dimension {
2825+
dimension: dimension_token,
2826+
} => (dimension_token.raw_value, dimension_token.raw_unit),
28112827
_ => {
28122828
unreachable!();
28132829
}
@@ -2833,9 +2849,9 @@ where
28332849
// u <dimension-token> '?'*
28342850
tok!("dimension") => {
28352851
let raw = match bump!(self) {
2836-
Token::Dimension { dimension: dimension_token } => {
2837-
(dimension_token.raw_value, dimension_token.raw_unit)
2838-
}
2852+
Token::Dimension {
2853+
dimension: dimension_token,
2854+
} => (dimension_token.raw_value, dimension_token.raw_unit),
28392855
_ => {
28402856
unreachable!();
28412857
}

crates/swc_css_visit/src/generated.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84604,9 +84604,7 @@ impl<V: ?Sized + Fold> FoldWith<V> for Token {
8460484604
let raw = { <swc_atoms::Atom as FoldWith<V>>::fold_with(raw, visitor) };
8460584605
Token::BadUrl { raw }
8460684606
}
84607-
Token::Delim { value } => {
84608-
Token::Delim { value }
84609-
}
84607+
Token::Delim { value } => Token::Delim { value },
8461084608
Token::Number {
8461184609
value,
8461284610
raw,

crates/swc_ecma_ast/src/expr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,10 @@ pub struct ArrayLit {
519519
pub span: Span,
520520

521521
#[cfg_attr(feature = "serde-impl", serde(default, rename = "elements"))]
522-
#[cfg_attr(feature = "encoding-impl", encoding(with = "swc_common::serializer::ArrayOption"))]
522+
#[cfg_attr(
523+
feature = "encoding-impl",
524+
encoding(with = "swc_common::serializer::ArrayOption")
525+
)]
523526
pub elems: Vec<Option<ExprOrSpread>>,
524527
}
525528

crates/swc_ecma_ast/src/pat.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ pub struct ArrayPat {
9393
pub span: Span,
9494

9595
#[cfg_attr(feature = "serde-impl", serde(rename = "elements"))]
96-
#[cfg_attr(feature = "encoding-impl", encoding(with = "swc_common::serializer::ArrayOption"))]
96+
#[cfg_attr(
97+
feature = "encoding-impl",
98+
encoding(with = "swc_common::serializer::ArrayOption")
99+
)]
97100
pub elems: Vec<Option<Pat>>,
98101

99102
/// Only in an ambient context

0 commit comments

Comments
 (0)