10

I have the following code fragment.

function forward(address destination, bytes memory data) public { 
    (bool res, bytes memory retData) = destination.call(data);
    assert(res);
}

Since retData is not used, I am getting the following warning (compiled with solidity 0.5.0):

Compilation warnings encountered:

/Users/ivica/Documents/deka/hekate.reloaded/digits-node/contracts/IdentityProxy.sol:55:20:
Warning: Unused local variable.
        (bool res, bytes memory retData) = destination.call(data);
                   ^------------------^

Question: how to get rid of it?

1 Answer 1

14

Does this work for you?

pragma solidity ^0.5.2;

contract Test {

    function forward(address destination, bytes memory data) public { 
        (bool res, ) = destination.call(data);
        assert(res);
    }
}

Basically we are omitting the second assignment.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.