ethcontract-rs
ethcontract-rs copied to clipboard
Special Case: Contract event emits with no values
Currently when generating contract from abi for an event with no output values (like this one)
The resulting contract looks like this
) -> Result<Self, self::ethcontract::tokens::Error> {
let () = self::ethcontract::tokens::Tokenize::from_token(token)?;
Ok(FactoryDisabled())
}
Which causes the following error/warning:
Compiling contracts v0.1.0 (/Users/bensniff/Projects/cowprotocol/services/crates/contracts)
error: this let-binding has unit value
--> /Users/bensniff/Projects/cowprotocol/services/target/debug/build/contracts-85b524e76e657330/out/BalancerV2StablePoolFactoryV2.rs:432:17
|
432 | let () = self::ethcontract::tokens::Tokenize::from_token(token)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `self::ethcontract::tokens::Tokenize::from_token(token)?;`
|
= note: `-D clippy::let-unit-value` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
We could probably work around this with a clippy-ignore statement of some kind, but may also want to address this case head on.
I suspect there is some part of this file that will need to be updated
https://github.com/gnosis/ethcontract-rs/blob/dcbfbe594f65eb2cc9e22a5468b7212ad1aa2a39/ethcontract-generate/src/generate/events.rs#L1
For more context: see https://github.com/cowprotocol/services/pull/371