Skip to content

Commit b7aa1e3

Browse files
committed
Fix clippy lints for optional features
1 parent b655db4 commit b7aa1e3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/sop/optim/mip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct SopModeler<'a> {
5555

5656
impl<'a> SopModeler<'a> {
5757
/// Initial creation of the modeler
58-
fn new(functions: &[Lut], and_cost: i32, xor_cost: i32, or_cost: i32) -> SopModeler {
58+
fn new(functions: &[Lut], and_cost: i32, xor_cost: i32, or_cost: i32) -> SopModeler<'_> {
5959
SopModeler {
6060
functions,
6161
and_cost,
@@ -286,7 +286,7 @@ struct EsopModeler<'a> {
286286

287287
impl<'a> EsopModeler<'a> {
288288
/// Initial creation of the modeler
289-
fn new(functions: &[Lut], and_cost: i32, xor_cost: i32) -> EsopModeler {
289+
fn new(functions: &[Lut], and_cost: i32, xor_cost: i32) -> EsopModeler<'_> {
290290
EsopModeler {
291291
functions,
292292
and_cost,

src/sop/optim/sat.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct SopModeler<'a> {
4949

5050
impl<'a> SopModeler<'a> {
5151
/// Initial creation of the modeler
52-
fn new(functions: &[Lut], and_cost: isize, xor_cost: isize, or_cost: isize) -> SopModeler {
52+
fn new(functions: &[Lut], and_cost: isize, xor_cost: isize, or_cost: isize) -> SopModeler<'_> {
5353
SopModeler {
5454
functions,
5555
and_cost,
@@ -333,7 +333,7 @@ struct EsopModeler<'a> {
333333

334334
impl<'a> EsopModeler<'a> {
335335
/// Initial creation of the modeler
336-
fn new(functions: &[Lut], and_cost: isize, xor_cost: isize) -> EsopModeler {
336+
fn new(functions: &[Lut], and_cost: isize, xor_cost: isize) -> EsopModeler<'_> {
337337
EsopModeler {
338338
functions,
339339
and_cost,
@@ -419,10 +419,9 @@ impl<'a> EsopModeler<'a> {
419419

420420
/// Add a xor constraint to the model using these variables
421421
fn add_xor_constraint(&mut self, vars: Vec<Lit>, value: bool) {
422-
assert!(vars.len() >= 1);
422+
assert!(!vars.is_empty());
423423
let mut xor_val = vars[0];
424-
for i in 1..vars.len() {
425-
let v = vars[i];
424+
for &v in vars.iter().skip(1) {
426425
let next_val = self.instance.new_var().pos_lit();
427426
self.instance.add_ternary(!xor_val, !next_val, !v);
428427
self.instance.add_ternary(!xor_val, next_val, v);

0 commit comments

Comments
 (0)