gridcoin-community / Gridcoin-Research

Gridcoin-Research
MIT License
585 stars 173 forks source link

rpc/server: fix removing deprecated commands from command list #2768

Closed lrusak closed 4 weeks ago

lrusak commented 1 month ago

The call to std::remove also requires using std::vector::erase

see: https://en.cppreference.com/w/cpp/algorithm/remove

This fixes the following warning:

/home/lukas/Documents/git/Gridcoin-Research/src/rpc/server.cpp:935:20: warning: ignoring return value of ‘_FIter std::remove(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >; _Tp = const char*]’, declared with attribute ‘nodiscard’ [-Wunused-result]
  935 |         std::remove(commandList.begin(), commandList.end(), command);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/span.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/uint256.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/consensus/params.h:9,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/chainparams.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/main.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/consensus/tx_verify.h:8,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/wallet/wallet.h:16,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/init.h:9,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/rpc/server.cpp:7:
/usr/include/c++/14/bits/stl_algo.h:788:5: note: declared here
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~