From fa946520d229ae45b30519bccc9eaa2c47b4a093 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 2 Jun 2025 14:16:06 +0200 Subject: [PATCH] refactor: Use structured binding for-loop --- src/rpc/server.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 8d120f41ef4..bd99615bbf0 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -1,5 +1,5 @@ // 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 // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -79,15 +80,13 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest& for (const auto& entry : mapCommands) vCommands.emplace_back(entry.second.front()->category + entry.first, entry.second.front()); - sort(vCommands.begin(), vCommands.end()); + std::ranges::sort(vCommands); JSONRPCRequest jreq = helpreq; jreq.mode = JSONRPCRequest::GET_HELP; jreq.params = UniValue(); - for (const std::pair& command : vCommands) - { - const CRPCCommand *pcmd = command.second; + for (const auto& [_, pcmd] : vCommands) { std::string strMethod = pcmd->name; if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand) continue;