From ddb69a1260756e4411f72cd33d70e237ed726e38 Mon Sep 17 00:00:00 2001 From: Mark Schmale Date: Thu, 13 Sep 2018 10:50:22 +0200 Subject: [PATCH] chore(fmt): cargo fmt --- benches/format_parser.rs | 4 +--- src/format.rs | 14 ++++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/benches/format_parser.rs b/benches/format_parser.rs index 4d80298..142f2d2 100644 --- a/benches/format_parser.rs +++ b/benches/format_parser.rs @@ -8,9 +8,7 @@ use std::str::FromStr; fn format_parser_bench(c: &mut Criterion) { c.bench_function("short format", |b| { - b.iter(|| { - Format::from_str(r#"$remote_addr [$time_local] "$request" $status"#) - }) + b.iter(|| Format::from_str(r#"$remote_addr [$time_local] "$request" $status"#)) }); c.bench_function("combined format", |b| { b.iter(|| { diff --git a/src/format.rs b/src/format.rs index 50da261..d777f6b 100644 --- a/src/format.rs +++ b/src/format.rs @@ -181,9 +181,9 @@ fn read_format(bytes: &[u8]) -> Result { (Variable(start, end), Fixed(_, _)) => stack.push(FormatPart::Variable( create_owned_str(&bytes, *start, *end)?, )), - (Variable(start, end), Variable(b_start, _)) if b_start > start => stack.push(FormatPart::Variable( - create_owned_str(&bytes, *start, *end)?, - )), + (Variable(start, end), Variable(b_start, _)) if b_start > start => stack.push( + FormatPart::Variable(create_owned_str(&bytes, *start, *end)?), + ), (Fixed(start, end), Variable(_, _)) => { stack.push(FormatPart::Fixed(create_owned_str(&bytes, *start, *end)?)) } @@ -266,7 +266,13 @@ mod test { let format_input = "$remote_add$remote_user"; let format = Format::from_str(format_input).unwrap(); - assert_eq!(vec![Variable(String::from("remote_add")), Variable(String::from("remote_user"))], format.parts); + assert_eq!( + vec![ + Variable(String::from("remote_add")), + Variable(String::from("remote_user")), + ], + format.parts + ); } #[test]