From b631ad78bc9fa16b23be9e0a28e72bb28f0320d7 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sat, 3 Jul 2021 18:46:22 -0400 Subject: [PATCH] rustfmt --- src/parse/ident.rs | 8 ++++++-- src/parse/module.rs | 10 ++++++---- src/parse/value/css_function.rs | 20 ++++++++++++++------ src/parse/variable.rs | 7 ++++++- src/selector/extend/functions.rs | 9 ++++++++- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/parse/ident.rs b/src/parse/ident.rs index 7a60bd0..7324c5b 100644 --- a/src/parse/ident.rs +++ b/src/parse/ident.rs @@ -99,8 +99,12 @@ impl<'a> Parser<'a> { value += as_hex(next.kind); self.toks.next(); } - if matches!(self.toks.peek(), Some(Token { kind: ' ', .. }) | Some(Token { kind: '\n', .. }) | Some(Token { kind: '\t', .. })) - { + if matches!( + self.toks.peek(), + Some(Token { kind: ' ', .. }) + | Some(Token { kind: '\n', .. }) + | Some(Token { kind: '\t', .. }) + ) { self.toks.next(); } } else { diff --git a/src/parse/module.rs b/src/parse/module.rs index bc14170..a7dac87 100644 --- a/src/parse/module.rs +++ b/src/parse/module.rs @@ -68,10 +68,12 @@ impl<'a> Parser<'a> { self.expect_char(':')?; self.whitespace_or_comment(); - let value = self.parse_value( - false, - &|toks| matches!(toks.peek(), Some(Token { kind: ',', .. }) | Some(Token { kind: ')', .. })) - )?; + let value = self.parse_value(false, &|toks| { + matches!( + toks.peek(), + Some(Token { kind: ',', .. }) | Some(Token { kind: ')', .. }) + ) + })?; config.insert(name.map_node(|n| n.into()), value)?; diff --git a/src/parse/value/css_function.rs b/src/parse/value/css_function.rs index a8e8127..2a1b907 100644 --- a/src/parse/value/css_function.rs +++ b/src/parse/value/css_function.rs @@ -205,16 +205,20 @@ impl<'a> Parser<'a> { match self.toks.peek() { Some(Token { kind: 'i', .. }) | Some(Token { kind: 'I', .. }) => { self.toks.advance_cursor(); - if !matches!(self.toks.peek(), Some(Token { kind: 'n', .. }) | Some(Token { kind: 'N', .. })) - { + if !matches!( + self.toks.peek(), + Some(Token { kind: 'n', .. }) | Some(Token { kind: 'N', .. }) + ) { return Ok(None); } buf.push_str("min(") } Some(Token { kind: 'a', .. }) | Some(Token { kind: 'A', .. }) => { self.toks.advance_cursor(); - if !matches!(self.toks.peek(), Some(Token { kind: 'x', .. }) | Some(Token { kind: 'X', .. })) - { + if !matches!( + self.toks.peek(), + Some(Token { kind: 'x', .. }) | Some(Token { kind: 'X', .. }) + ) { return Ok(None); } buf.push_str("max(") @@ -377,8 +381,12 @@ impl<'a> Parser<'a> { span = span.merge(next.pos); self.toks.peek_forward(1); } - if matches!(self.toks.peek(), Some(Token { kind: ' ', .. }) | Some(Token { kind: '\n', .. }) | Some(Token { kind: '\t', .. })) - { + if matches!( + self.toks.peek(), + Some(Token { kind: ' ', .. }) + | Some(Token { kind: '\n', .. }) + | Some(Token { kind: '\t', .. }) + ) { self.toks.peek_forward(1); } } else { diff --git a/src/parse/variable.rs b/src/parse/variable.rs index 3ffc1a7..df1ae53 100644 --- a/src/parse/variable.rs +++ b/src/parse/variable.rs @@ -115,7 +115,12 @@ impl<'a> Parser<'a> { let value = self.parse_value(true, &|toks| { if matches!(toks.peek(), Some(Token { kind: '!', .. })) { - let is_important = matches!(toks.peek_next(), Some(Token { kind: 'i', .. }) | Some(Token { kind: 'I', .. }) | Some(Token { kind: '=', .. })); + let is_important = matches!( + toks.peek_next(), + Some(Token { kind: 'i', .. }) + | Some(Token { kind: 'I', .. }) + | Some(Token { kind: '=', .. }) + ); toks.reset_cursor(); !is_important } else { diff --git a/src/selector/extend/functions.rs b/src/selector/extend/functions.rs index 6dbe2f3..8811bbb 100644 --- a/src/selector/extend/functions.rs +++ b/src/selector/extend/functions.rs @@ -761,5 +761,12 @@ fn must_unify( /// Returns whether a `CompoundSelector` may contain only one simple selector of /// the same type as `simple`. fn is_unique(simple: &SimpleSelector) -> bool { - matches!(simple, SimpleSelector::Id(..) | SimpleSelector::Pseudo(Pseudo { is_class: false, .. })) + matches!( + simple, + SimpleSelector::Id(..) + | SimpleSelector::Pseudo(Pseudo { + is_class: false, + .. + }) + ) }