style: fix formatting for rustfmt compliance

- Add trailing newlines to all source files
- Remove extra blank lines
- Simplify closure formatting in benchmarks
This commit is contained in:
Stefano Amorelli
2025-08-16 17:43:01 +03:00
parent 5f8585c434
commit b7a229ead9
5 changed files with 15 additions and 15 deletions

View File

@@ -4,24 +4,21 @@ use crabrl::Parser;
fn parse_small_file(c: &mut Criterion) {
let parser = Parser::new();
let content = include_bytes!("../tests/fixtures/small.xml");
c.bench_function("parse_small", |b| {
b.iter(|| {
parser.parse_bytes(black_box(content))
});
b.iter(|| parser.parse_bytes(black_box(content)));
});
}
fn parse_medium_file(c: &mut Criterion) {
let parser = Parser::new();
let content = include_bytes!("../tests/fixtures/medium.xml");
c.bench_function("parse_medium", |b| {
b.iter(|| {
parser.parse_bytes(black_box(content))
});
b.iter(|| parser.parse_bytes(black_box(content)));
});
}
criterion_group!(benches, parse_small_file, parse_medium_file);
criterion_main!(benches);
criterion_main!(benches);

View File

@@ -33,4 +33,5 @@ fn main() {
std::process::exit(1);
}
}
}
}

View File

@@ -19,4 +19,5 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!(" Units: {}", doc.units.len());
Ok(())
}
}

View File

@@ -26,4 +26,5 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
Ok(())
}
}

View File

@@ -11,13 +11,12 @@ fn main() {
let filepath = &args[1];
let parser = Parser::new();
let start = Instant::now();
match parser.parse_file(filepath) {
Ok(doc) => {
let elapsed = start.elapsed();
let ms = elapsed.as_secs_f64() * 1000.0;
println!("crabrl found: {} facts, {} contexts, {} units (in {:.3}ms)",
doc.facts.len(),
doc.contexts.len(),
@@ -37,4 +36,5 @@ fn main() {
std::process::exit(1);
}
}
}
}