Skip to content

Commit 47c25ec

Browse files
committed
rustfmt
1 parent 2c5c2ef commit 47c25ec

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

build/match_byte.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ fn get_byte_from_expr_lit(expr: &Box<syn::Expr>) -> u8 {
7373
}
7474

7575
/// Parse a pattern and fill the table accordingly
76-
fn parse_pat_to_table<'a>(pat: &'a syn::Pat, case_id: u8, wildcard: &mut Option<&'a syn::Ident>, table: &mut [u8; 256]) {
76+
fn parse_pat_to_table<'a>(
77+
pat: &'a syn::Pat,
78+
case_id: u8,
79+
wildcard: &mut Option<&'a syn::Ident>,
80+
table: &mut [u8; 256],
81+
) {
7782
match pat {
7883
&syn::Pat::Lit(syn::PatLit { ref expr, .. }) => {
7984
let value = get_byte_from_expr_lit(expr);
@@ -108,7 +113,7 @@ fn parse_pat_to_table<'a>(pat: &'a syn::Pat, case_id: u8, wildcard: &mut Option<
108113
*byte = case_id;
109114
}
110115
}
111-
},
116+
}
112117
&syn::Pat::Or(syn::PatOr { ref cases, .. }) => {
113118
for case in cases {
114119
parse_pat_to_table(case, case_id, wildcard, table);

src/rules_and_declarations.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,7 @@ where
268268
let start = self.input.state();
269269
// FIXME: remove intermediate variable when lifetimes are non-lexical
270270
let ident = match self.input.next_including_whitespace_and_comments() {
271-
Ok(&Token::WhiteSpace(_)) | Ok(&Token::Comment(_)) | Ok(&Token::Semicolon) => {
272-
continue
273-
}
271+
Ok(&Token::WhiteSpace(_)) | Ok(&Token::Comment(_)) | Ok(&Token::Semicolon) => continue,
274272
Ok(&Token::Ident(ref name)) => Ok(Ok(name.clone())),
275273
Ok(&Token::AtKeyword(ref name)) => Ok(Err(name.clone())),
276274
Ok(token) => Err(token.clone()),

src/serializer.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,24 @@ impl TokenSerializationType {
451451
),
452452
Number => matches!(
453453
other.0,
454-
Ident | Function | UrlOrBadUrl | DelimMinus | Number | Percentage | DelimPercent | Dimension
454+
Ident
455+
| Function
456+
| UrlOrBadUrl
457+
| DelimMinus
458+
| Number
459+
| Percentage
460+
| DelimPercent
461+
| Dimension
455462
),
456463
DelimAt => matches!(other.0, Ident | Function | UrlOrBadUrl | DelimMinus),
457464
DelimDotOrPlus => matches!(other.0, Number | Percentage | Dimension),
458465
DelimAssorted | DelimAsterisk => matches!(other.0, DelimEquals),
459466
DelimBar => matches!(other.0, DelimEquals | DelimBar | DashMatch),
460467
DelimSlash => matches!(other.0, DelimAsterisk | SubstringMatch),
461468
Nothing | WhiteSpace | Percentage | UrlOrBadUrl | Function | CDC | OpenParen
462-
| DashMatch | SubstringMatch | DelimQuestion | DelimEquals | DelimPercent | Other => false,
469+
| DashMatch | SubstringMatch | DelimQuestion | DelimEquals | DelimPercent | Other => {
470+
false
471+
}
463472
}
464473
}
465474
}

src/tests.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
extern crate test;
77

88
use encoding_rs;
9-
use serde_json::{self, Value, json, Map};
9+
use serde_json::{self, json, Map, Value};
1010

1111
#[cfg(feature = "bench")]
1212
use self::test::Bencher;
@@ -30,7 +30,7 @@ fn almost_equals(a: &Value, b: &Value) -> bool {
3030
let a = a.as_f64().unwrap();
3131
let b = b.as_f64().unwrap();
3232
(a - b).abs() <= a.abs() * 1e-6
33-
},
33+
}
3434

3535
(&Value::Bool(a), &Value::Bool(b)) => a == b,
3636
(&Value::String(ref a), &Value::String(ref b)) => a == b,
@@ -410,15 +410,16 @@ fn unicode_range() {
410410
Ok(None)
411411
}
412412
});
413-
result.unwrap()
413+
result
414+
.unwrap()
414415
.iter()
415-
.map(|v|
416-
if let Some((v0, v1)) = v{
416+
.map(|v| {
417+
if let Some((v0, v1)) = v {
417418
json!([v0, v1])
418419
} else {
419420
Value::Null
420421
}
421-
)
422+
})
422423
.collect::<Vec<_>>()
423424
.to_json()
424425
});
@@ -809,7 +810,11 @@ trait ToJson {
809810
fn to_json(&self) -> Value;
810811
}
811812

812-
impl<T> ToJson for T where T: Clone, Value: From<T> {
813+
impl<T> ToJson for T
814+
where
815+
T: Clone,
816+
Value: From<T>,
817+
{
813818
fn to_json(&self) -> Value {
814819
Value::from(self.clone())
815820
}

0 commit comments

Comments
 (0)