Skip to content

Commit 30f553d

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26707: clang-tidy: Fix performance-*move* warnings in headers
1308b83 clang-tidy: Fix `performance-no-automatic-move` in headers (Hennadii Stepanov) 0a5dc03 clang-tidy: Fix `performance-move-const-arg` in headers (Hennadii Stepanov) Pull request description: Split from bitcoin/bitcoin#26705 as was requested in bitcoin/bitcoin#26705 (comment). To test this PR, consider applying a diff as follows: ```diff --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,16 +1,7 @@ Checks: ' -*, -bugprone-argument-comment, -bugprone-use-after-move, -misc-unused-using-decls, -modernize-use-default-member-init, -modernize-use-nullptr, -performance-for-range-copy, performance-move-const-arg, performance-no-automatic-move, -performance-unnecessary-copy-initialization, -readability-redundant-declaration, -readability-redundant-string-init, ' WarningsAsErrors: ' bugprone-argument-comment, @@ -28,4 +19,4 @@ readability-redundant-string-init, CheckOptions: - key: performance-move-const-arg.CheckTriviallyCopyableMove value: false -HeaderFilterRegex: './qt' +HeaderFilterRegex: '.' ``` ACKs for top commit: fanquake: ACK 1308b83 Tree-SHA512: b7ef9a3e789846130ab4c3fd6fbe8d887bdbcd438e4cbc78e2b1ac01f819ae13d7f69c2a25f480bd36e3e7f58886a7d5a8609a3c3275c315e0697cd4010474bd
2 parents 3ce7b27 + 1308b83 commit 30f553d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/fs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class path : public std::filesystem::path
3535
// Allow path objects arguments for compatibility.
3636
path(std::filesystem::path path) : std::filesystem::path::path(std::move(path)) {}
3737
path& operator=(std::filesystem::path path) { std::filesystem::path::operator=(std::move(path)); return *this; }
38-
path& operator/=(std::filesystem::path path) { std::filesystem::path::operator/=(std::move(path)); return *this; }
38+
path& operator/=(std::filesystem::path path) { std::filesystem::path::operator/=(path); return *this; }
3939

4040
// Allow literal string arguments, which are safe as long as the literals are ASCII.
4141
path(const char* c) : std::filesystem::path(c) {}

src/script/miniscript.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ inline NodeRef<Key> Parse(Span<const char> in, const Ctx& ctx)
13781378
assert(constructed.size() == 1);
13791379
assert(constructed[0]->ScriptSize() == script_size);
13801380
if (in.size() > 0) return {};
1381-
const NodeRef<Key> tl_node = std::move(constructed.front());
1381+
NodeRef<Key> tl_node = std::move(constructed.front());
13821382
tl_node->DuplicateKeyCheck(ctx);
13831383
return tl_node;
13841384
}
@@ -1813,7 +1813,7 @@ inline NodeRef<Key> DecodeScript(I& in, I last, const Ctx& ctx)
18131813
}
18141814
}
18151815
if (constructed.size() != 1) return {};
1816-
const NodeRef<Key> tl_node = std::move(constructed.front());
1816+
NodeRef<Key> tl_node = std::move(constructed.front());
18171817
tl_node->DuplicateKeyCheck(ctx);
18181818
// Note that due to how ComputeType works (only assign the type to the node if the
18191819
// subs' types are valid) this would fail if any node of tree is badly typed.

0 commit comments

Comments
 (0)