diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-16 12:03:00 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-16 12:07:15 +0200 |
| commit | 5edbd3a5b58c11939ea9823c6a847ba447254cb6 (patch) | |
| tree | 0b0ad36451f5a3b85bd0406fdb656cd0d2a11890 /src | |
| parent | 81f2f8f4c335dc399174d7c44a226bbc2cf98c8f (diff) | |
Use array's IntoIterator impl and nested or patterns
*yay*
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/incremental.rs | 4 | ||||
| -rw-r--r-- | src/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/parse/parser.rs | 5 | ||||
| -rw-r--r-- | src/parse/tokens.rs | 2 |
4 files changed, 5 insertions, 8 deletions
diff --git a/src/layout/incremental.rs b/src/layout/incremental.rs index 429dc514..ca4839b6 100644 --- a/src/layout/incremental.rs +++ b/src/layout/incremental.rs @@ -227,12 +227,12 @@ impl Constraints { /// Changes all constraints by adding the `size` to them if they are `Some`. pub fn mutate(&mut self, size: Size, regions: &Regions) { - for spec in std::array::IntoIter::new([ + for spec in [ &mut self.min, &mut self.max, &mut self.exact, &mut self.base, - ]) { + ] { if let Some(horizontal) = spec.horizontal.as_mut() { *horizontal += size.width; } diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 6724c559..38a489b2 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -249,7 +249,7 @@ fn expr_with(p: &mut Parser, atomic: bool, min_prec: usize) -> Option<Expr> { // call. if matches!( p.peek_direct(), - Some(Token::Excl) | Some(Token::LeftParen) | Some(Token::LeftBracket), + Some(Token::Excl | Token::LeftParen | Token::LeftBracket), ) { lhs = call(p, lhs)?; continue; diff --git a/src/parse/parser.rs b/src/parse/parser.rs index d4192b50..5fba961a 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -381,10 +381,7 @@ impl<'s> Parser<'s> { /// Whether the active group ends at a newline. fn stop_at_newline(&self) -> bool { let active = self.groups.last().map(|group| group.kind); - matches!( - active, - Some(Group::Stmt) | Some(Group::Expr) | Some(Group::Imports) - ) + matches!(active, Some(Group::Stmt | Group::Expr | Group::Imports)) } /// Whether we are inside the given group. diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs index e9af7acb..356a2f96 100644 --- a/src/parse/tokens.rs +++ b/src/parse/tokens.rs @@ -898,7 +898,7 @@ mod tests { t!(Code[" /"]: large.to_string() => Float(large)); // Combined integers and floats. - let nums = ints.iter().map(|&(k, v)| (k, v as f64)).chain(floats.iter().copied()); + let nums = ints.iter().map(|&(k, v)| (k, v as f64)).chain(floats); let suffixes = [ ("%", Percent as fn(f64) -> Token<'static>), |
