Skip to content

Commit

Permalink
refactor: reduced use of return statements
Browse files Browse the repository at this point in the history
  • Loading branch information
harshkhandeparkar committed Nov 4, 2024
1 parent 95afbc8 commit 7559b58
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions backend/src/qp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ impl TryFrom<&String> for Exam {
Ok(Exam::Endsem)
} else if let Some(stripped) = value.strip_prefix("ct") {
if stripped.is_empty() {
return Ok(Exam::CT(None));
}

if let Ok(i) = stripped.parse::<usize>() {
Ok(Exam::CT(None))
} else if let Ok(i) = stripped.parse::<usize>() {
Ok(Exam::CT(Some(i)))
} else {
Err(eyre!("Error parsing exam: Invalid class test number."))
Expand Down

0 comments on commit 7559b58

Please sign in to comment.