Skip to content

Commit f38c5ae

Browse files
committed
Run fmt and fix typos
1 parent a844a71 commit f38c5ae

File tree

2 files changed

+21
-33
lines changed

2 files changed

+21
-33
lines changed

crates/deno_task_shell/src/grammar.pest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,14 @@ logical_and = { "&&" }
203203
logical_or = { "||" }
204204

205205
unary_arithmetic_expr = !{
206-
unary_pre_arithmetic_expr | unary_post_arithmatic_expr
206+
unary_pre_arithmetic_expr | unary_post_arithmetic_expr
207207
}
208208

209209
unary_pre_arithmetic_expr = !{
210210
(post_arithmetic_op | unary_arithmetic_op) ~ (parentheses_expr | VARIABLE | NUMBER)
211211
}
212212

213-
unary_post_arithmatic_expr = !{
213+
unary_post_arithmetic_expr = !{
214214
(parentheses_expr | VARIABLE | NUMBER) ~ post_arithmetic_op
215215
}
216216

crates/deno_task_shell/src/parser.rs

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,12 +1422,8 @@ fn parse_unary_arithmetic_expr(pair: Pair<Rule>) -> Result<ArithmeticPart> {
14221422
let first = inner.next().unwrap();
14231423

14241424
match first.as_rule() {
1425-
Rule::unary_pre_arithmetic_expr => {
1426-
unary_pre_arithmetic_expr(first)
1427-
}
1428-
Rule::unary_post_arithmatic_expr => {
1429-
unary_post_arithmatic_expr(first)
1430-
}
1425+
Rule::unary_pre_arithmetic_expr => unary_pre_arithmetic_expr(first),
1426+
Rule::unary_post_arithmetic_expr => unary_post_arithmetic_expr(first),
14311427
_ => {
14321428
let operand = parse_arithmetic_expr(first)?;
14331429
let op = parse_post_arithmetic_op(inner.next().unwrap())?;
@@ -1443,31 +1439,26 @@ fn parse_unary_arithmetic_op_type(pair: Pair<Rule>) -> Result<bool> {
14431439
match pair.as_rule() {
14441440
Rule::unary_arithmetic_op => Ok(true),
14451441
Rule::post_arithmetic_op => Ok(false),
1446-
_ => {
1447-
Err(miette!(
1448-
"Unexpected rule in unary arithmetic operator: {:?}",
1449-
pair.as_rule()
1450-
))
1451-
}
1442+
_ => Err(miette!(
1443+
"Unexpected rule in unary arithmetic operator: {:?}",
1444+
pair.as_rule()
1445+
)),
14521446
}
14531447
}
14541448

14551449
fn unary_pre_arithmetic_expr(pair: Pair<Rule>) -> Result<ArithmeticPart> {
14561450
let mut inner = pair.into_inner();
14571451
let first = inner.next().unwrap();
14581452
let second = inner.next().unwrap();
1459-
let operand =
1460-
match second.as_rule() {
1453+
let operand = match second.as_rule() {
14611454
Rule::parentheses_expr => {
14621455
let inner = second.into_inner().next().unwrap();
14631456
let parts = parse_arithmetic_sequence(inner)?;
14641457
Ok(ArithmeticPart::ParenthesesExpr(Box::new(Arithmetic {
14651458
parts,
14661459
})))
1467-
},
1468-
Rule::VARIABLE => {
1469-
Ok(ArithmeticPart::Variable(second.as_str().to_string()))
14701460
}
1461+
Rule::VARIABLE => Ok(ArithmeticPart::Variable(second.as_str().to_string())),
14711462
Rule::NUMBER => Ok(ArithmeticPart::Number(second.as_str().to_string())),
14721463
_ => Err(miette!(
14731464
"Unexpected rule in arithmetic expression: {:?}",
@@ -1478,44 +1469,41 @@ fn unary_pre_arithmetic_expr(pair: Pair<Rule>) -> Result<ArithmeticPart> {
14781469
if parse_unary_arithmetic_op_type(first.clone())? {
14791470
let op = parse_unary_arithmetic_op(first)?;
14801471
Ok(ArithmeticPart::UnaryArithmeticExpr {
1481-
operator: (op),
1482-
operand: (Box::new(operand))
1472+
operator: (op),
1473+
operand: (Box::new(operand)),
14831474
})
14841475
} else {
14851476
let op = parse_post_arithmetic_op(first)?;
1486-
Ok(ArithmeticPart::PostArithmeticExpr {
1487-
operator: (op),
1488-
operand: (Box::new(operand))
1477+
Ok(ArithmeticPart::PostArithmeticExpr {
1478+
operator: (op),
1479+
operand: (Box::new(operand)),
14891480
})
14901481
}
14911482
}
14921483

1493-
fn unary_post_arithmatic_expr(pair: Pair<Rule>) -> Result<ArithmeticPart> {
1484+
fn unary_post_arithmetic_expr(pair: Pair<Rule>) -> Result<ArithmeticPart> {
14941485
let mut inner = pair.into_inner();
14951486
let first = inner.next().unwrap();
14961487
let second = inner.next().unwrap();
1497-
let operand =
1498-
match first.as_rule() {
1488+
let operand = match first.as_rule() {
14991489
Rule::parentheses_expr => {
15001490
let inner = first.into_inner().next().unwrap();
15011491
let parts = parse_arithmetic_sequence(inner)?;
15021492
Ok(ArithmeticPart::ParenthesesExpr(Box::new(Arithmetic {
15031493
parts,
15041494
})))
1505-
},
1506-
Rule::VARIABLE => {
1507-
Ok(ArithmeticPart::Variable(first.as_str().to_string()))
15081495
}
1496+
Rule::VARIABLE => Ok(ArithmeticPart::Variable(first.as_str().to_string())),
15091497
Rule::NUMBER => Ok(ArithmeticPart::Number(first.as_str().to_string())),
15101498
_ => Err(miette!(
15111499
"Unexpected rule in arithmetic expression: {:?}",
15121500
first.as_rule()
15131501
)),
15141502
}?;
15151503
let op = parse_post_arithmetic_op(second)?;
1516-
Ok(ArithmeticPart::PostArithmeticExpr {
1517-
operator: (op),
1518-
operand: (Box::new(operand))
1504+
Ok(ArithmeticPart::PostArithmeticExpr {
1505+
operator: (op),
1506+
operand: (Box::new(operand)),
15191507
})
15201508
}
15211509

0 commit comments

Comments
 (0)