Skip to content

Commit

Permalink
fix: Simply match statements to if let
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzaaft committed Jul 29, 2022
1 parent 9d47bb7 commit 3c25d20
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
43 changes: 14 additions & 29 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,21 +248,15 @@ fn main() -> anyhow::Result<()> {
}

// extra spliced sequence
match spliced {
Some(es) => {
cmd.arg(String::from("--extra-spliced"));
cmd.arg(format!("{}", es.display()));
}
None => {}
if let Some(es) = spliced {
cmd.arg(String::from("--extra-spliced"));
cmd.arg(format!("{}", es.display()));
}

// extra unspliced sequence
match unspliced {
Some(eu) => {
cmd.arg(String::from("--extra-unspliced"));
cmd.arg(format!("{}", eu.display()));
}
None => {}
if let Some(eu) = unspliced {
cmd.arg(String::from("--extra-unspliced"));
cmd.arg(format!("{}", eu.display()));
}

cmd.arg(fasta)
Expand Down Expand Up @@ -395,25 +389,16 @@ fn main() -> anyhow::Result<()> {
}
}
} else {
match explicit_pl {
Some(filtered_path) => {
filter_meth_opt = Some(CellFilterMethod::ExplicitList(
filtered_path.to_string_lossy().into_owned(),
));
}
None => {}
if let Some(filtered_path) = explicit_pl {
filter_meth_opt = Some(CellFilterMethod::ExplicitList(
filtered_path.to_string_lossy().into_owned(),
));
};
match forced_cells {
Some(num_forced) => {
filter_meth_opt = Some(CellFilterMethod::ForceCells(num_forced));
}
None => {}
if let Some(num_forced) = forced_cells {
filter_meth_opt = Some(CellFilterMethod::ForceCells(num_forced));
};
match expect_cells {
Some(num_expected) => {
filter_meth_opt = Some(CellFilterMethod::ExpectCells(num_expected));
}
None => {}
if let Some(num_expected) = expect_cells {
filter_meth_opt = Some(CellFilterMethod::ExpectCells(num_expected));
};
}
// otherwise it must have been knee;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/af_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn add_chemistry_to_args(chem_str: &str, cmd: &mut std::process::Command) ->
return Ok(());
}
None => {
if chem_str.contains(";") {
if chem_str.contains(';') {
// parse this as a custom
let v: Vec<&str> = chem_str.split(';').collect();
// one string must start with 'B', one with 'U' and one with 'R'
Expand Down
4 changes: 2 additions & 2 deletions src/utils/prog_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ pub fn get_which_executable(prog_name: &str) -> Result<PathBuf> {
Ok(p)
}
Err(e) => {
return Err(anyhow!(
Err(anyhow!(
"could not find `{}` in your path: {}",
prog_name,
e
));
))
}
}
}
Expand Down

0 comments on commit 3c25d20

Please sign in to comment.