mirror of
https://github.com/themasch/nginx-log-parser.git
synced 2025-06-14 16:36:34 +00:00
chore(fmt): cargo fmt
This commit is contained in:
@ -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(|| {
|
||||
|
@ -181,9 +181,9 @@ fn read_format(bytes: &[u8]) -> Result<Format, FormatParserError> {
|
||||
(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]
|
||||
|
Reference in New Issue
Block a user