Skip to content

Commit fab92a5

Browse files
author
MarcoFalke
committed
refactor: Remove const to fix performance-move-const-arg clang-tidy errors
The warnings look like: src/rpc/util.h:192:19: error: std::move of the const variable 'name' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg,-warnings-as-errors] : m_names{std::move(name)}, ^~~~~~~~~~ ~
1 parent 635f190 commit fab92a5

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/rpc/util.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ struct RPCArg {
178178
const RPCArgOptions m_opts;
179179

180180
RPCArg(
181-
const std::string name,
182-
const Type type,
183-
const Fallback fallback,
184-
const std::string description,
181+
std::string name,
182+
Type type,
183+
Fallback fallback,
184+
std::string description,
185185
RPCArgOptions opts = {})
186186
: m_names{std::move(name)},
187187
m_type{std::move(type)},
@@ -193,11 +193,11 @@ struct RPCArg {
193193
}
194194

195195
RPCArg(
196-
const std::string name,
197-
const Type type,
198-
const Fallback fallback,
199-
const std::string description,
200-
const std::vector<RPCArg> inner,
196+
std::string name,
197+
Type type,
198+
Fallback fallback,
199+
std::string description,
200+
std::vector<RPCArg> inner,
201201
RPCArgOptions opts = {})
202202
: m_names{std::move(name)},
203203
m_type{std::move(type)},
@@ -263,12 +263,12 @@ struct RPCResult {
263263
const std::string m_cond;
264264

265265
RPCResult(
266-
const std::string cond,
267-
const Type type,
268-
const std::string m_key_name,
269-
const bool optional,
270-
const std::string description,
271-
const std::vector<RPCResult> inner = {})
266+
std::string cond,
267+
Type type,
268+
std::string m_key_name,
269+
bool optional,
270+
std::string description,
271+
std::vector<RPCResult> inner = {})
272272
: m_type{std::move(type)},
273273
m_key_name{std::move(m_key_name)},
274274
m_inner{std::move(inner)},
@@ -282,19 +282,19 @@ struct RPCResult {
282282
}
283283

284284
RPCResult(
285-
const std::string cond,
286-
const Type type,
287-
const std::string m_key_name,
288-
const std::string description,
289-
const std::vector<RPCResult> inner = {})
290-
: RPCResult{cond, type, m_key_name, false, description, inner} {}
285+
std::string cond,
286+
Type type,
287+
std::string m_key_name,
288+
std::string description,
289+
std::vector<RPCResult> inner = {})
290+
: RPCResult{std::move(cond), type, std::move(m_key_name), /*optional=*/false, std::move(description), std::move(inner)} {}
291291

292292
RPCResult(
293-
const Type type,
294-
const std::string m_key_name,
295-
const bool optional,
296-
const std::string description,
297-
const std::vector<RPCResult> inner = {},
293+
Type type,
294+
std::string m_key_name,
295+
bool optional,
296+
std::string description,
297+
std::vector<RPCResult> inner = {},
298298
bool skip_type_check = false)
299299
: m_type{std::move(type)},
300300
m_key_name{std::move(m_key_name)},
@@ -308,12 +308,12 @@ struct RPCResult {
308308
}
309309

310310
RPCResult(
311-
const Type type,
312-
const std::string m_key_name,
313-
const std::string description,
314-
const std::vector<RPCResult> inner = {},
311+
Type type,
312+
std::string m_key_name,
313+
std::string description,
314+
std::vector<RPCResult> inner = {},
315315
bool skip_type_check = false)
316-
: RPCResult{type, m_key_name, false, description, inner, skip_type_check} {}
316+
: RPCResult{type, std::move(m_key_name), /*optional=*/false, std::move(description), std::move(inner), skip_type_check} {}
317317

318318
/** Append the sections of the result. */
319319
void ToSections(Sections& sections, OuterType outer_type = OuterType::NONE, const int current_indent = 0) const;

0 commit comments

Comments
 (0)