Skip to content

Commit

Permalink
lint: use std::move() where appropriate
Browse files Browse the repository at this point in the history
Suggested by Coverity.

Closes: csutils#154
  • Loading branch information
kdudka committed Dec 13, 2023
1 parent 4f43fe8 commit fa6848d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cshtml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ int main(int argc, char *argv[])
// initialize CWE names lookup
CweNameLookup cweNames;
if (!fnCweNames.empty()) {
InStream strCweNames(fnCweNames);
InStream strCweNames(std::move(fnCweNames));
cweNames.parse(strCweNames);
writer.setCweNameLookup(&cweNames);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser-common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void ImpliedAttrDigger::inferToolFromChecker(
// we use COMPILER_WARNING for "gcc" due to historical reasons
tool = "gcc";

pDef->tool = tool;
pDef->tool = std::move(tool);
}
else
// no tool matched --> assume coverity
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser-cov.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ EToken ErrFileLexer::readNext()
}

if (!boost::regex_match(line, sm, reEvent_)) {
evt_.msg = line;
evt_.msg = std::move(line);
return T_UNKNOWN;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/parser-json-sarif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ void SarifTreeDecoder::readScanProps(

if (!version.empty())
// record tool version of Snyk Code
(*pDst)["analyzer-version-snyk-code"] = version;
(*pDst)["analyzer-version-snyk-code"] = std::move(version);
}
else if (name == "gitleaks") {
// gitleaks
d->singleChecker = "GITLEAKS_WARNING";

if (!version.empty())
(*pDst)["analyzer-version-gitleaks"] = version;
(*pDst)["analyzer-version-gitleaks"] = std::move(version);
}
else if (boost::starts_with(name, "GNU C")) {
// GCC
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser-xml-valgrind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void ValgrindTreeDecoder::readRoot(const pt::ptree *root)
// create a note event in the defect prototype
d->defPrototype.events.push_back(DefEvent("note"));
DefEvent &noteEvt = d->defPrototype.events.back();
noteEvt.fileName = exe;
noteEvt.fileName = std::move(exe);

// record PID and command-line args
std::ostringstream str;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/writer-html.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void HtmlWriterCore::writeHeaderOnce(
title = titleFallback_;

// initialize a HTML document
HtmlLib::initHtml(str_, title);
HtmlLib::initHtml(str_, std::move(title));
if (!plainTextUrl.empty())
HtmlLib::writeLink(str_, plainTextUrl, "[Show plain-text results]");

Expand Down
2 changes: 1 addition & 1 deletion src/lib/writer-json-sarif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,5 @@ void SarifTreeEncoder::writeTo(std::ostream &str)
root["runs"] = array{std::move(run0)};

// encode as JSON
jsonPrettyPrint(str, root);
jsonPrettyPrint(str, std::move(root));
}

0 comments on commit fa6848d

Please sign in to comment.