elliottt / easy-smt

Easy SMT solver interaction
Apache License 2.0
24 stars 4 forks source link

`SExpr::is_list` is always false according to clippy #13

Closed rachitnigam closed 1 year ago

rachitnigam commented 1 year ago

On running cargo clippy, we get the warning:

error: incompatible bit mask: `_ & 2147483648` can never be equal to `1`
  --> src/sexpr.rs:47:9
   |
47 |         self.index & (1 << 31) == 1
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bad_bit_mask
   = note: `#[deny(clippy::bad_bit_mask)]` on by default

The line is in the SExpr::is_list method. Is this warning correct or it is misunderstanding the interned representation of SExprs?

sampsyo commented 1 year ago

Just a drive-by because I am subscribed to issues on this repo: the warning seems right to me! x & (1 << 31) will equal 1 << 31 when the bit is set, not 1. So maybe this is supposed to be != 0.

fitzgen commented 1 year ago

So maybe this is supposed to be != 0.

Yeah, whoops.