Skip to content

Commit 79945a2

Browse files
committed
chore: apply rustfmt
1 parent 1315db1 commit 79945a2

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

tl_parser/src/lib.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ impl Combinator {
6868
}
6969

7070
pub fn constructor_number_be(&self) -> u32 {
71-
self
72-
.constructor_number
71+
self.constructor_number
7372
.unwrap_or_else(|| crc32fast::hash(self.constructor_number_form().as_bytes()))
7473
.to_be()
7574
}
7675

7776
pub fn constructor_number_le(&self) -> u32 {
78-
self
79-
.constructor_number
77+
self.constructor_number
8078
.unwrap_or_else(|| crc32fast::hash(self.constructor_number_form().as_bytes()))
8179
}
8280
}
@@ -271,7 +269,8 @@ pub fn parse(input: &str) -> anyhow::Result<Vec<Combinator>> {
271269
alt((combinator_decl, builtin_combinator_decl)),
272270
opt(space_or_comment),
273271
)),
274-
)).parse(input)
272+
))
273+
.parse(input)
275274
.map_err(|e| anyhow!("parse error: {}", e))?;
276275

277276
if let Some(types) = types {
@@ -289,7 +288,8 @@ pub fn parse(input: &str) -> anyhow::Result<Vec<Combinator>> {
289288
alt((functional_combinator_decl, builtin_combinator_decl)),
290289
opt(space_or_comment),
291290
)),
292-
)).parse(input)
291+
))
292+
.parse(input)
293293
.map_err(|e: nom::Err<Error<&str>>| anyhow!("parse error: {}", e))?;
294294

295295
if let Some(funcs) = funcs {
@@ -348,7 +348,8 @@ fn space_or_comment(input: &str) -> nom::IResult<&str, ()> {
348348
single_line_comment,
349349
multi_line_comment,
350350
line_ending,
351-
))).parse(input)?;
351+
)))
352+
.parse(input)?;
352353

353354
Ok((input, ()))
354355
}
@@ -379,7 +380,8 @@ fn uc_ident_ns(input: &str) -> nom::IResult<&str, String> {
379380
let (input, ns) = opt(terminated(
380381
separated_list1(tag("."), namespace_ident),
381382
tag("."),
382-
)).parse(input)?;
383+
))
384+
.parse(input)?;
383385
let (input, head) = uc_ident(input)?;
384386

385387
match ns {
@@ -442,7 +444,8 @@ fn opt_args(input: &str) -> nom::IResult<&str, Vec<OptionalField>> {
442444
let (input, names) = preceded(
443445
tag("{"),
444446
many1(delimited(space0, var_ident, space_or_comment)),
445-
).parse(input)?;
447+
)
448+
.parse(input)?;
446449
let (input, _) = delimited(space0, tag(":"), space_or_comment).parse(input)?;
447450
let (input, type_name) = terminated(type_expr, tag("}")).parse(input)?;
448451

@@ -484,8 +487,10 @@ fn combinator_decl(input: &str) -> nom::IResult<&str, Combinator> {
484487
fn functional_combinator_decl(input: &str) -> nom::IResult<&str, Combinator> {
485488
let (input, (combinator_id, constructor_number)) =
486489
preceded(multispace0, full_combinator_id).parse(input)?;
487-
let (input, opts) = opt(delimited(space_or_comment, opt_args, space_or_comment)).parse(input)?;
488-
let (input, fields) = many0(delimited(space_or_comment, args, space_or_comment)).parse(input)?;
490+
let (input, opts) =
491+
opt(delimited(space_or_comment, opt_args, space_or_comment)).parse(input)?;
492+
let (input, fields) =
493+
many0(delimited(space_or_comment, args, space_or_comment)).parse(input)?;
489494
let (input, _) = delimited(multispace0, tag("="), multispace0).parse(input)?;
490495
let (input, (_, combinator_type)) = result_type(input)?;
491496
let (input, _) = preceded(multispace0, tag(";")).parse(input)?;
@@ -570,15 +575,17 @@ fn subexpr(input: &str) -> nom::IResult<&str, String> {
570575
)),
571576
|vs: Vec<String>| vs.join("+"),
572577
),
573-
)).parse(input)
578+
))
579+
.parse(input)
574580
}
575581

576582
fn type_ident(input: &str) -> nom::IResult<&str, String> {
577583
alt((
578584
boxed_type_ident,
579585
lc_ident_ns,
580586
map(tag("#"), |s: &str| s.to_owned()),
581-
)).parse(input)
587+
))
588+
.parse(input)
582589
}
583590

584591
fn term(input: &str) -> nom::IResult<&str, String> {
@@ -595,7 +602,8 @@ fn term(input: &str) -> nom::IResult<&str, String> {
595602
var_ident,
596603
map(nat_const, |s| s.to_owned()),
597604
preceded(tag("%"), term),
598-
)).parse(input)
605+
))
606+
.parse(input)
599607
}
600608

601609
fn type_term(input: &str) -> nom::IResult<&str, (bool, String)> {

0 commit comments

Comments
 (0)