Skip to content

Commit

Permalink
driveby: simplify logic from_extension_op
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Nov 30, 2023
1 parent 74ff7ff commit 04fdad0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/std_extensions/logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,10 @@ impl OpName for ConcreteLogicOp {
impl MakeExtensionOp for ConcreteLogicOp {
fn from_extension_op(ext_op: &ExtensionOp) -> Result<Self, OpLoadError> {
let def: NaryLogic = NaryLogic::from_def(ext_op.def())?;
Ok(match def {
NaryLogic::And | NaryLogic::Or => {
let [TypeArg::BoundedNat { n }] = *ext_op.args() else {
return Err(SignatureError::InvalidTypeArgs.into());
};
Self(def, n)
}
})
let [TypeArg::BoundedNat { n }] = *ext_op.args() else {
return Err(SignatureError::InvalidTypeArgs.into());
};
Ok(Self(def, n))
}

fn type_args(&self) -> Vec<TypeArg> {
Expand Down

0 comments on commit 04fdad0

Please sign in to comment.