Skip to content

Commit

Permalink
Remove clippy unwrap suppression and use match syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Feb 16, 2023
1 parent 6d01f43 commit b192444
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/euler_one_qubit_decomposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// that they have been altered from the originals.

#![allow(clippy::too_many_arguments)]
#![allow(clippy::unnecessary_unwrap)]

use hashbrown::HashMap;
use num_complex::{Complex64, ComplexFloat};
Expand Down Expand Up @@ -338,13 +337,14 @@ where
circuit.global_phase -= PI / 2.;
// emit circuit
pfun(&mut circuit, lam);
if xpifun.is_some() && mod_2pi(theta).abs() < atol {
xpifun.unwrap()(&mut circuit);
} else {
xfun(&mut circuit);
pfun(&mut circuit, theta);
xfun(&mut circuit);
}
match xpifun {
Some(mut xpifun) if mod_2pi(theta).abs() < atol => xpifun(&mut circuit),
_ => {
xfun(&mut circuit);
pfun(&mut circuit, theta);
xfun(&mut circuit);
}
};
pfun(&mut circuit, phi);
circuit
}
Expand Down

0 comments on commit b192444

Please sign in to comment.