refactor: Use structured binding for-loop
This commit is contained in:
1 file changed
+4
-5
+4
-5
@@ -1,5 +1,5 @@
|
|||||||
// Copyright (c) 2010 Satoshi Nakamoto
|
// Copyright (c) 2010 Satoshi Nakamoto
|
||||||
// Copyright (c) 2009-2022 The Bitcoin Core developers
|
// Copyright (c) 2009-present The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -79,15 +80,13 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest&
|
|||||||
|
|
||||||
for (const auto& entry : mapCommands)
|
for (const auto& entry : mapCommands)
|
||||||
vCommands.emplace_back(entry.second.front()->category + entry.first, entry.second.front());
|
vCommands.emplace_back(entry.second.front()->category + entry.first, entry.second.front());
|
||||||
sort(vCommands.begin(), vCommands.end());
|
std::ranges::sort(vCommands);
|
||||||
|
|
||||||
JSONRPCRequest jreq = helpreq;
|
JSONRPCRequest jreq = helpreq;
|
||||||
jreq.mode = JSONRPCRequest::GET_HELP;
|
jreq.mode = JSONRPCRequest::GET_HELP;
|
||||||
jreq.params = UniValue();
|
jreq.params = UniValue();
|
||||||
|
|
||||||
for (const std::pair<std::string, const CRPCCommand*>& command : vCommands)
|
for (const auto& [_, pcmd] : vCommands) {
|
||||||
{
|
|
||||||
const CRPCCommand *pcmd = command.second;
|
|
||||||
std::string strMethod = pcmd->name;
|
std::string strMethod = pcmd->name;
|
||||||
if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
|
if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in new issue
Block a user