Skip to content

Commit

Permalink
refactor: pass LineSpec as a struct to process_chunk
Browse files Browse the repository at this point in the history
Avoids clippy issue surrounding "too many arguments"
  • Loading branch information
zietzm committed Jul 22, 2024
1 parent ddb3755 commit f10defa
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ impl ProcessingStats {
}
}

fn process_chunk(
gwas_result_files: Vec<String>,
column_names: io::gwas::ColumnSpec,
struct LineSpec {
start_line: usize,
end_line: usize,
num_lines: usize,
}

fn process_chunk(
gwas_result_files: Vec<String>,
column_names: io::gwas::ColumnSpec,
lines: LineSpec,
output_file: &str,
runtime_config: &RuntimeConfig,
running: Arc<Mutex<RunningSufficientStats>>,
Expand Down Expand Up @@ -182,9 +186,9 @@ fn process_chunk(
gwas_reader(
&gwas_result_files,
column_names,
start_line,
end_line,
num_lines,
lines.start_line,
lines.end_line,
lines.num_lines,
sender,
)
}
Expand All @@ -205,7 +209,7 @@ fn process_chunk(
let final_stats = running.lock().unwrap().compute_final_stats();

info!("Writing results to file: {}", output_file);
let include_header = start_line == 0;
let include_header = lines.start_line == 0;
io::gwas::write_gwas_results(
final_stats,
output_file,
Expand Down Expand Up @@ -272,9 +276,11 @@ pub fn run(
process_chunk(
gwas_result_files.clone(),
column_names.clone(),
start_line,
end_line,
num_lines,
LineSpec {
start_line,
end_line,
num_lines,
},
output_file,
&runtime_config,
running.clone(),
Expand Down

0 comments on commit f10defa

Please sign in to comment.