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

Remove unnecessary use-retval from wxString::erase #3127

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

jbrownsw
Copy link
Contributor

I could see use-retval potentially making since in a loop if I'm using the iterator version, but using the version that returns a ref to itself there's no reason to use that return value.

Simple example that reproduces this:

int main()
{
  wxString str = GetString();
  if (str.size() > 2)
    str.erase(0, 2);

  return str.size();
}

Output:

cppcheck.exe --enable=all --inconclusive --library=wxwidgets.cfg test.cpp
Checking test.cpp ...
test.cpp:5:9: warning: Return value of function str.erase() is not used. [ignoredReturnValue]
    str.erase(0, 2);
        ^

@orbitcowboy
Copy link
Collaborator

Thanks!

@orbitcowboy orbitcowboy merged commit 7e1ecdb into danmar:main Feb 12, 2021
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

Successfully merging this pull request may close these issues.

2 participants