Skip to content

Commit dddde27

Browse files
author
MarcoFalke
committed
Add [[nodiscard]] where ignoring a Result return type is an error
1 parent a2e111b commit dddde27

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/addrdb.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ util::Result<std::unique_ptr<AddrMan>> LoadAddrman(const NetGroupManager& netgro
210210
return util::Error{strprintf(_("Invalid or corrupt peers.dat (%s). If you believe this is a bug, please report it to %s. As a workaround, you can move the file (%s) out of the way (rename, move, or delete) to have a new one created on the next start."),
211211
e.what(), PACKAGE_BUGREPORT, fs::quoted(fs::PathToString(path_addr)))};
212212
}
213-
return std::move(addrman); // std::move should be unneccessary but is temporarily needed to work around clang bug (https://github.com/bitcoin/bitcoin/pull/25977#issuecomment-1561270092)
213+
return {std::move(addrman)}; // std::move should be unneccessary but is temporarily needed to work around clang bug
214+
// (https://github.com/bitcoin/bitcoin/pull/25977#issuecomment-1561270092)
214215
}
215216

216217
void DumpAnchors(const fs::path& anchors_db_path, const std::vector<CAddress>& anchors)

src/kernel/checks.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ struct Context;
1616
/**
1717
* Ensure a usable environment with all necessary library support.
1818
*/
19-
util::Result<void> SanityChecks(const Context&);
20-
21-
}
19+
[[nodiscard]] util::Result<void> SanityChecks(const Context&);
20+
} // namespace kernel
2221

2322
#endif // BITCOIN_KERNEL_CHECKS_H

src/node/blockmanager_args.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class ArgsManager;
1313

1414
namespace node {
15-
util::Result<void> ApplyArgsManOptions(const ArgsManager& args, BlockManager::Options& opts);
15+
[[nodiscard]] util::Result<void> ApplyArgsManOptions(const ArgsManager& args, BlockManager::Options& opts);
1616
} // namespace node
1717

1818
#endif // BITCOIN_NODE_BLOCKMANAGER_ARGS_H

src/node/chainstatemanager_args.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class ArgsManager;
1212

1313
namespace node {
14-
util::Result<void> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts);
14+
[[nodiscard]] util::Result<void> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts);
1515
} // namespace node
1616

1717
#endif // BITCOIN_NODE_CHAINSTATEMANAGER_ARGS_H

src/txdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ class CBlockTreeDB : public CDBWrapper
9999
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
100100
};
101101

102-
util::Result<void> CheckLegacyTxindex(CBlockTreeDB& block_tree_db);
102+
[[nodiscard]] util::Result<void> CheckLegacyTxindex(CBlockTreeDB& block_tree_db);
103103

104104
#endif // BITCOIN_TXDB_H

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ struct MigrationResult {
10741074
};
10751075

10761076
//! Do all steps to migrate a legacy wallet to a descriptor wallet
1077-
util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& wallet_name, const SecureString& passphrase, WalletContext& context);
1077+
[[nodiscard]] util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& wallet_name, const SecureString& passphrase, WalletContext& context);
10781078
} // namespace wallet
10791079

10801080
#endif // BITCOIN_WALLET_WALLET_H

0 commit comments

Comments
 (0)