Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special Case: Contract event emits with no values #796

Open
bh2smith opened this issue Jul 18, 2022 · 0 comments
Open

Special Case: Contract event emits with no values #796

bh2smith opened this issue Jul 18, 2022 · 0 comments

Comments

@bh2smith
Copy link
Contributor

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 cowprotocol/services#371

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant