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?

ivicaa
  • 7,519
  • 1
  • 20
  • 50

1 Answers1

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.

Shawn Tabrizi
  • 8,008
  • 4
  • 19
  • 38