indexed-finance/indexed-core

Remove implicit returns for everything except structs and arrays

d1ll0n opened this issue · 0 comments

Implement suggestion from @cleanunicorn to remove use of implicit returns in functions where they are not used.

Recommendation

Remove all implicit returns and only use explicit returns.
If you want to have a summary of what the functions do, consider using NatSpec docstrings and also describe return arguments.

Changes

  • Add natspec docstrings for function parameters and return values
  • Remove all implicit returns
  • Remove named return values in IPool.sol for everything except in-memory variables

Reason for using named return values for memory values:

When a struct or array is declared as a return parameter, regardless of whether it is assigned a name, solc expands memory to accommodate it. As a result, it is almost always cheaper to use a named return value, even if an explicit return is still used.

See this gist for an example with decompiled contracts