Skip to content

Commit c6275d3

Browse files
committed
style: cargo fmt + clippy --fix to satisfy rust-ci (fmt --check + clippy -D warnings)
1 parent 6ceb137 commit c6275d3

3 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/codegen/benchmark.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ fn generate_julia_benchmark(manifest: &Manifest, units: &[TranslationUnit]) -> S
8383
writeln!(out, "# Auto-generated by julianiser — benchmark script").expect("TODO: handle error");
8484
writeln!(out, "# Project: {}", manifest.project.name).expect("TODO: handle error");
8585
writeln!(out, "#").expect("TODO: handle error");
86-
writeln!(out, "# Run with: julia --project=. benchmarks/benchmark.jl").expect("TODO: handle error");
86+
writeln!(out, "# Run with: julia --project=. benchmarks/benchmark.jl")
87+
.expect("TODO: handle error");
8788
writeln!(out).expect("TODO: handle error");
8889

8990
writeln!(out, "using BenchmarkTools").expect("TODO: handle error");
@@ -112,7 +113,8 @@ fn generate_julia_benchmark(manifest: &Manifest, units: &[TranslationUnit]) -> S
112113
writeln!(out, "println(\"=\"^60)").expect("TODO: handle error");
113114
writeln!(out).expect("TODO: handle error");
114115

115-
writeln!(out, "# Warm up Julia's JIT compiler before benchmarking.").expect("TODO: handle error");
116+
writeln!(out, "# Warm up Julia's JIT compiler before benchmarking.")
117+
.expect("TODO: handle error");
116118
writeln!(out, "println(\"Warming up JIT...\")").expect("TODO: handle error");
117119
for unit in units {
118120
writeln!(out, "try").expect("TODO: handle error");
@@ -147,7 +149,8 @@ fn generate_julia_benchmark(manifest: &Manifest, units: &[TranslationUnit]) -> S
147149
unit.module_name
148150
)
149151
.expect("TODO: handle error");
150-
writeln!(out, "display(bench_{})", to_snake(&unit.module_name)).expect("TODO: handle error");
152+
writeln!(out, "display(bench_{})", to_snake(&unit.module_name))
153+
.expect("TODO: handle error");
151154
writeln!(out, "println()").expect("TODO: handle error");
152155
writeln!(out).expect("TODO: handle error");
153156
}
@@ -238,8 +241,10 @@ fn generate_benchmark_runner(manifest: &Manifest, units: &[TranslationUnit]) ->
238241

239242
match unit.language {
240243
SourceLanguage::Python => {
241-
writeln!(out, "if command -v python3 &> /dev/null; then").expect("TODO: handle error");
242-
writeln!(out, " echo \"Timing: python3 {}\"", unit.source_path).expect("TODO: handle error");
244+
writeln!(out, "if command -v python3 &> /dev/null; then")
245+
.expect("TODO: handle error");
246+
writeln!(out, " echo \"Timing: python3 {}\"", unit.source_path)
247+
.expect("TODO: handle error");
243248
writeln!(
244249
out,
245250
" time python3 \"$PROJECT_DIR/../{}\" 2>&1 || echo \" (Python script failed or not found)\"",
@@ -255,8 +260,10 @@ fn generate_benchmark_runner(manifest: &Manifest, units: &[TranslationUnit]) ->
255260
writeln!(out, "fi").expect("TODO: handle error");
256261
}
257262
SourceLanguage::R => {
258-
writeln!(out, "if command -v Rscript &> /dev/null; then").expect("TODO: handle error");
259-
writeln!(out, " echo \"Timing: Rscript {}\"", unit.source_path).expect("TODO: handle error");
263+
writeln!(out, "if command -v Rscript &> /dev/null; then")
264+
.expect("TODO: handle error");
265+
writeln!(out, " echo \"Timing: Rscript {}\"", unit.source_path)
266+
.expect("TODO: handle error");
260267
writeln!(
261268
out,
262269
" time Rscript \"$PROJECT_DIR/../{}\" 2>&1 || echo \" (R script failed or not found)\"",

src/codegen/julia_gen.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ pub fn generate_julia_module(unit: &TranslationUnit, manifest_mappings: &[Mappin
227227
writeln!(output, "function run_pipeline()").expect("TODO: handle error");
228228

229229
if unit.detected_calls.is_empty() {
230-
writeln!(output, " # No translatable library calls detected.").expect("TODO: handle error");
230+
writeln!(output, " # No translatable library calls detected.")
231+
.expect("TODO: handle error");
231232
writeln!(output, " @info \"No operations to run.\"").expect("TODO: handle error");
232233
} else {
233234
for call in &unit.detected_calls {
@@ -364,7 +365,8 @@ pub fn generate_project_toml(manifest: &Manifest, units: &[TranslationUnit]) ->
364365
if let Some(uuid) = uuids.get(pkg.as_str()) {
365366
writeln!(output, "{} = \"{}\"", pkg, uuid).expect("TODO: handle error");
366367
} else {
367-
writeln!(output, "# {} = \"<uuid>\" # TODO: look up UUID", pkg).expect("TODO: handle error");
368+
writeln!(output, "# {} = \"<uuid>\" # TODO: look up UUID", pkg)
369+
.expect("TODO: handle error");
368370
}
369371
}
370372

src/codegen/parser.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ pub fn parse_python_source(source_path: &str, content: &str) -> Result<Translati
148148

149149
// Detect `import X as Y` or `import X`
150150
if trimmed.starts_with("import ") && !trimmed.starts_with("import(") {
151-
let rest = trimmed.strip_prefix("import ").expect("TODO: handle error").trim();
151+
let rest = trimmed
152+
.strip_prefix("import ")
153+
.expect("TODO: handle error")
154+
.trim();
152155
if let Some((module, alias)) = rest.split_once(" as ") {
153156
let module = module.trim();
154157
let alias = alias.trim();

0 commit comments

Comments
 (0)