Skip to content

Commit d46da59

Browse files
committed
clippy & fmt
1 parent 4d47855 commit d46da59

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

z3rro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ pub mod orders;
2020
pub mod scope;
2121

2222
pub mod model;
23+
pub mod probes;
2324
pub mod prover;
2425
pub mod smtlib;
2526
mod uint;
26-
pub mod probes;
2727
pub use uint::UInt;
2828
mod ureal;
2929
pub use ureal::UReal;

z3rro/src/probes.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,20 @@ use enum_map::{Enum, EnumMap};
66
use itertools::Itertools;
77
use z3::{Context, Goal, Probe};
88

9-
fn run_bool_probe<'ctx>(name: &str, ctx: &'ctx Context, goal: &Goal) -> bool {
9+
fn run_bool_probe(name: &str, ctx: &Context, goal: &Goal) -> bool {
1010
let probe = Probe::new(ctx, name);
11-
match probe.apply(goal) {
12-
0.0 => false,
13-
_ => true,
14-
}
11+
probe.apply(goal) != 0.0
1512
}
1613

1714
/// Run the `has-quantifiers` probe: it returns true if the goal contains
1815
/// quantifiers.
19-
pub fn has_quantifiers<'ctx>(ctx: &'ctx Context, goal: &Goal) -> bool {
16+
pub fn has_quantifiers(ctx: &Context, goal: &Goal) -> bool {
2017
run_bool_probe("has-quantifiers", ctx, goal)
2118
}
2219

2320
/// Run the `has-patterns` probe: it returns true if the goal contains
2421
/// quantifiers with patterns.
25-
pub fn has_patterns<'ctx>(ctx: &'ctx Context, goal: &Goal) -> bool {
22+
pub fn has_patterns(ctx: &Context, goal: &Goal) -> bool {
2623
run_bool_probe("has-patterns", ctx, goal)
2724
}
2825

@@ -58,7 +55,7 @@ impl Display for TheoryProbe {
5855
}
5956

6057
/// Run the appropriate probe based on the given theory.
61-
pub fn is_theory<'ctx>(ctx: &'ctx Context, goal: &Goal, theory: TheoryProbe) -> bool {
58+
pub fn is_theory(ctx: &Context, goal: &Goal, theory: TheoryProbe) -> bool {
6259
let probe_name = match theory {
6360
TheoryProbe::Lia => "is-lia",
6461
TheoryProbe::Lira => "is-lira",
@@ -72,11 +69,11 @@ pub fn is_theory<'ctx>(ctx: &'ctx Context, goal: &Goal, theory: TheoryProbe) ->
7269

7370
/// Run the `is-unbounded` probe: it returns true if the goal contains
7471
/// integer/real constants that do not have lower/upper bounds.
75-
pub fn is_unbounded<'ctx>(ctx: &'ctx Context, goal: &Goal) -> bool {
72+
pub fn is_unbounded(ctx: &Context, goal: &Goal) -> bool {
7673
run_bool_probe("is-unbounded", ctx, goal)
7774
}
7875

79-
fn run_int_probe<'ctx>(name: &str, ctx: &'ctx Context, goal: &Goal) -> usize {
76+
fn run_int_probe(name: &str, ctx: &Context, goal: &Goal) -> usize {
8077
let probe = Probe::new(ctx, name);
8178
let float_res = probe.apply(goal);
8279
assert!(float_res.fract() == 0.0, "expected integer result");
@@ -85,31 +82,31 @@ fn run_int_probe<'ctx>(name: &str, ctx: &'ctx Context, goal: &Goal) -> usize {
8582

8683
/// Run the `num-arith-consts` probe: it returns the number of arithmetic
8784
/// constants in the given goal.
88-
pub fn num_arith_consts<'ctx>(ctx: &'ctx Context, goal: &Goal) -> usize {
85+
pub fn num_arith_consts(ctx: &Context, goal: &Goal) -> usize {
8986
run_int_probe("num-arith-consts", ctx, goal)
9087
}
9188

9289
/// Run the `num-bool-consts` probe: it returns the number of Boolean
9390
/// constants in the given goal.
94-
pub fn num_bool_consts<'ctx>(ctx: &'ctx Context, goal: &Goal) -> usize {
91+
pub fn num_bool_consts(ctx: &Context, goal: &Goal) -> usize {
9592
run_int_probe("num-bool-consts", ctx, goal)
9693
}
9794

9895
/// Run the `num-bv-consts` probe: it returns the number of bit-vector
9996
/// constants in the given goal.
100-
pub fn num_bv_consts<'ctx>(ctx: &'ctx Context, goal: &Goal) -> usize {
97+
pub fn num_bv_consts(ctx: &Context, goal: &Goal) -> usize {
10198
run_int_probe("num-bv-consts", ctx, goal)
10299
}
103100

104101
/// Run the `num-consts` probe: it returns the number of non-Boolean
105102
/// constants in the given goal.
106-
pub fn num_consts<'ctx>(ctx: &'ctx Context, goal: &Goal) -> usize {
103+
pub fn num_consts(ctx: &Context, goal: &Goal) -> usize {
107104
run_int_probe("num-consts", ctx, goal)
108105
}
109106

110107
/// Run the `num-exprs` probe: it returns the number of expressions/terms
111108
/// in the given goal.
112-
pub fn num_exprs<'ctx>(ctx: &'ctx Context, goal: &Goal) -> usize {
109+
pub fn num_exprs(ctx: &Context, goal: &Goal) -> usize {
113110
run_int_probe("num-exprs", ctx, goal)
114111
}
115112

@@ -129,7 +126,7 @@ pub struct ProbeSummary {
129126

130127
impl ProbeSummary {
131128
/// Run a bunch of slected probes on the goal.
132-
pub fn probe<'ctx>(ctx: &'ctx Context, goal: &Goal) -> Self {
129+
pub fn probe(ctx: &Context, goal: &Goal) -> Self {
133130
Self {
134131
has_quantifiers: has_quantifiers(ctx, goal),
135132
has_patterns: has_patterns(ctx, goal),

0 commit comments

Comments
 (0)