Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Franklin Delehelle committed Aug 11, 2019
1 parent 4d02944 commit 6f47480
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
18 changes: 15 additions & 3 deletions src/automaton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ pub fn search_duplications(
i += step_size;
progress.store(i, Ordering::Relaxed);

if needle[i] == b'N' { continue; }
if needle[i] == b'N' {
continue;
}
let matches: Vec<Segment> = searcher
.search(strand, sa, &needle[i..i + settings.probe_size])
.into_iter()
Expand All @@ -119,15 +121,25 @@ pub fn search_duplications(
}
})
.collect();
if matches.len() > settings.max_cardinality { continue; }
if matches.len() > settings.max_cardinality {
continue;
}

// Reset dirty bits of arms
arms.iter_mut().for_each(|arm| arm.dirty = false);

let todo = matches
.par_iter()
.with_min_len(8)
.map(|m| try_extend_arms(&arms, m, i64::from(settings.max_gap_size), i, settings.probe_size) )
.map(|m| {
try_extend_arms(
&arms,
m,
i64::from(settings.max_gap_size),
i,
settings.probe_size,
)
})
.collect::<Vec<_>>();

todo.iter().for_each(|op| {
Expand Down
8 changes: 6 additions & 2 deletions src/bin/asgart-concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ fn main() {
let x = run();
if let Err(ref e) = x {
error!("{}", e);
for e in e.iter().skip(1) { println!("{}", e); }
if let Some(backtrace) = e.backtrace() { println!("Backtrace: {:?}", backtrace); }
for e in e.iter().skip(1) {
println!("{}", e);
}
if let Some(backtrace) = e.backtrace() {
println!("Backtrace: {:?}", backtrace);
}
std::process::exit(1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/bin/asgart-plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ fn read_feature_file(r: &RunResult, file: &str) -> Result<Vec<Feature>> {
let extension: &str = path.extension().unwrap().to_str().unwrap();

match extension {
"gff3" => {read_gff3_feature_file(r, file)}
_ => {read_custom_feature_file(r, file)}
"gff3" => read_gff3_feature_file(r, file),
_ => read_custom_feature_file(r, file),
}
}

Expand Down
16 changes: 13 additions & 3 deletions src/bin/asgart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,20 @@ impl<'a> Step for SearchDuplications<'a> {
thread::sleep(Duration::from_millis(500));
match rx_monitor.try_recv() {
Err(TryRecvError::Empty) => {
pb.set_position((progresses.iter().map(|x| x.load(Ordering::Relaxed))
.fold(0, |ax, x| ax + x) as f64/total as f64 * 100.0) as u64);
pb.set_position(
(progresses
.iter()
.map(|x| x.load(Ordering::Relaxed))
.fold(0, |ax, x| ax + x)
as f64
/ total as f64
* 100.0) as u64,
);
}
_ => {
pb.finish_and_clear();
break;
}
_ => { pb.finish_and_clear(); break; }
}
}
})
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
pub extern crate log;
#[macro_use]
pub extern crate serde_derive;
Expand Down
2 changes: 1 addition & 1 deletion src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl RunResult {
}

let r = RunResult {
settings: results[0].settings.clone(),
settings: results[0].settings,
strand: results[0].strand.clone(),
families: results
.iter()
Expand Down

0 comments on commit 6f47480

Please sign in to comment.