Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Nov 5, 2024
1 parent 0e9cb5b commit db36bd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
19 changes: 10 additions & 9 deletions crates/clarirs_py/src/ast/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ impl Bool {
#[pymethods]
impl Bool {
#[new]
pub fn py_new(
py: Python,
op: &str,
args: Vec<PyObject>,
) -> Result<Py<Bool>, ClaripyError> {
pub fn py_new(py: Python, op: &str, args: Vec<PyObject>) -> Result<Py<Bool>, ClaripyError> {
Bool::new(
py,
&match op {
Expand Down Expand Up @@ -97,7 +93,7 @@ impl Bool {
&args[1].downcast_bound::<PyAstString>(py)?.get().inner,
)?
}
},
}
"__ne__" => {
if args[0].downcast_bound::<Bool>(py).is_ok() {
GLOBAL_CONTEXT.neq(
Expand Down Expand Up @@ -172,8 +168,12 @@ impl Bool {
&args[0].downcast_bound::<FP>(py)?.get().inner,
&args[1].downcast_bound::<FP>(py)?.get().inner,
)?,
"fpIsNan" => GLOBAL_CONTEXT.fp_is_nan(&args[0].downcast_bound::<FP>(py)?.get().inner)?,
"fpIsInf" => GLOBAL_CONTEXT.fp_is_inf(&args[0].downcast_bound::<FP>(py)?.get().inner)?,
"fpIsNan" => {
GLOBAL_CONTEXT.fp_is_nan(&args[0].downcast_bound::<FP>(py)?.get().inner)?
}
"fpIsInf" => {
GLOBAL_CONTEXT.fp_is_inf(&args[0].downcast_bound::<FP>(py)?.get().inner)?
}
"StrContains" => GLOBAL_CONTEXT.strcontains(
&args[0].downcast_bound::<PyAstString>(py)?.get().inner,
&args[1].downcast_bound::<PyAstString>(py)?.get().inner,
Expand All @@ -186,7 +186,8 @@ impl Bool {
&args[0].downcast_bound::<PyAstString>(py)?.get().inner,
&args[1].downcast_bound::<PyAstString>(py)?.get().inner,
)?,
"StrIsDigit" => GLOBAL_CONTEXT.strisdigit(&args[0].downcast_bound::<PyAstString>(py)?.get().inner)?,
"StrIsDigit" => GLOBAL_CONTEXT
.strisdigit(&args[0].downcast_bound::<PyAstString>(py)?.get().inner)?,
"If" => GLOBAL_CONTEXT.if_(
&args[0].downcast_bound::<Bool>(py)?.get().inner,
&args[1].downcast_bound::<Bool>(py)?.get().inner,
Expand Down
12 changes: 9 additions & 3 deletions crates/clarirs_py/src/ast/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ impl PyAstString {
#[pymethods]
impl PyAstString {
#[new]
pub fn py_new(py: Python, op: &str, args: Vec<PyObject>) -> Result<Py<PyAstString>, ClaripyError> {
pub fn py_new(
py: Python,
op: &str,
args: Vec<PyObject>,
) -> Result<Py<PyAstString>, ClaripyError> {
PyAstString::new(
py,
&match op {
Expand All @@ -74,14 +78,16 @@ impl PyAstString {
&args[1].downcast_bound::<PyAstString>(py)?.get().inner,
&args[2].downcast_bound::<PyAstString>(py)?.get().inner,
)?,
"IntToStr" => GLOBAL_CONTEXT.bvtostr(&args[0].downcast_bound::<BV>(py)?.get().inner)?,
"IntToStr" => {
GLOBAL_CONTEXT.bvtostr(&args[0].downcast_bound::<BV>(py)?.get().inner)?
}
"If" => GLOBAL_CONTEXT.if_(
&args[0].downcast_bound::<Bool>(py)?.get().inner,
&args[1].downcast_bound::<PyAstString>(py)?.get().inner,
&args[2].downcast_bound::<PyAstString>(py)?.get().inner,
)?,
_ => return Err(ClaripyError::InvalidOperation(op.to_string())),
}
},
)
}

Expand Down

0 comments on commit db36bd8

Please sign in to comment.