Closed ccbrucer closed 3 years ago
For the raft lab, when compiling with rustc 1.50.0, clippy issues the error: Unnecessary nested match for the file raft/src/raft/tests.rs:693:17.
Unnecessary nested match
The original code is
if let Some(Some(raft)) = rafts.get_mut(i) { if let Some(raft) = raft { if raft.start(&random_entry(&mut random)).is_ok() { leader = Some(i); } } }
The code has been changed to
if let Some(Some(raft)) = rafts.get_mut(i) { if raft.start(&random_entry(&mut random)).is_ok() { leader = Some(i); } }
By reducing nested match, the error is fixed.
Tests
make test_others
Side effects
Related changes
What problem does this PR solve?
For the raft lab, when compiling with rustc 1.50.0, clippy issues the error:
Unnecessary nested match
for the file raft/src/raft/tests.rs:693:17.What is changed and how it works?
The original code is
The code has been changed to
By reducing nested match, the error is fixed.
Check List
Tests
Side effects
Related changes