OpenZeppelin / cairo-contracts

OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup
https://docs.openzeppelin.com/contracts-cairo
MIT License
797 stars 322 forks source link

fix: ensure option is used to remove warning #910

Closed glihm closed 4 months ago

glihm commented 4 months ago

When testing with the new 0.9.0 version, we had some warning when compiling a project:

warning: Unhandled `#[must_use]` type `core::option::Option::<@core::felt252>`
 --> /home/.cache/scarb/registry/git/checkouts/cairo-contracts-9cboa8jg3jldq/861fc41/src/tests/utils.cairo:26:5
    keys.pop_front();
    ^**************^

warning: Unhandled `#[must_use]` type `core::option::Option::<(core::array::Span::<core::felt252>, core::array::Span::<core::felt252>)>`
 --> /home/.cache/scarb/registry/git/checkouts/cairo-contracts-9cboa8jg3jldq/861fc41/src/tests/utils.cairo:51:5
    testing::pop_log_raw(address);
    ^***************************^

warning: Unhandled `#[must_use]` type `core::option::Option::<@core::felt252>`
 --> /home/.cache/scarb/registry/git/checkouts/cairo-contracts-9cboa8jg3jldq/861fc41/src/tests/utils.cairo:26:5
    keys.pop_front();
    ^**************^

warning: Unhandled `#[must_use]` type `core::option::Option::<(core::array::Span::<core::felt252>, core::array::Span::<core::felt252>)>`
 --> /home/.cache/scarb/registry/git/checkouts/cairo-contracts-9cboa8jg3jldq/861fc41/src/tests/utils.cairo:51:5
    testing::pop_log_raw(address);
    ^***************************^

Checking on main, this issue is still present. This PR aims at using the Option to avoid warnings.

PR Checklist

It's a very small fix for warnings, the test suite passes but I've not deployed a contract on public network as the issue is related to testing only. Not sure if the CHANGELOG applies in this occasion, but will be happy to complete any missing item. :+1:

glihm commented 4 months ago

@ericnordelo sorry then for the lack of pertinence here, appreciate your feedback and context. :+1: