mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 10:07:19 +02:00
clang-tidy: use '' for single character find
Found with performance-faster-string-find Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
b1e70fd780
commit
8ffb85b327
4 changed files with 7 additions and 7 deletions
|
@ -1533,7 +1533,7 @@ void CLI2::findIDs ()
|
||||||
for (auto& element : elements)
|
for (auto& element : elements)
|
||||||
{
|
{
|
||||||
changes = true;
|
changes = true;
|
||||||
auto hyphen = element.find ("-");
|
auto hyphen = element.find ('-');
|
||||||
if (hyphen != std::string::npos)
|
if (hyphen != std::string::npos)
|
||||||
_id_ranges.push_back (std::pair <std::string, std::string> (element.substr (0, hyphen), element.substr (hyphen + 1)));
|
_id_ranges.push_back (std::pair <std::string, std::string> (element.substr (0, hyphen), element.substr (hyphen + 1)));
|
||||||
else
|
else
|
||||||
|
@ -1588,7 +1588,7 @@ void CLI2::findIDs ()
|
||||||
for (const auto& element : elements)
|
for (const auto& element : elements)
|
||||||
{
|
{
|
||||||
changes = true;
|
changes = true;
|
||||||
auto hyphen = element.find ("-");
|
auto hyphen = element.find ('-');
|
||||||
if (hyphen != std::string::npos)
|
if (hyphen != std::string::npos)
|
||||||
_id_ranges.push_back (std::pair <std::string, std::string> (element.substr (0, hyphen), element.substr (hyphen + 1)));
|
_id_ranges.push_back (std::pair <std::string, std::string> (element.substr (0, hyphen), element.substr (hyphen + 1)));
|
||||||
else
|
else
|
||||||
|
|
|
@ -1689,7 +1689,7 @@ bool Lexer::decomposeSubstitution (
|
||||||
if (readWord (text, "/", cursor, parsed_to))
|
if (readWord (text, "/", cursor, parsed_to))
|
||||||
{
|
{
|
||||||
std::string parsed_flags = text.substr (cursor);
|
std::string parsed_flags = text.substr (cursor);
|
||||||
if (parsed_flags.find ("/") == std::string::npos)
|
if (parsed_flags.find ('/') == std::string::npos)
|
||||||
{
|
{
|
||||||
dequote (parsed_from, "/");
|
dequote (parsed_from, "/");
|
||||||
dequote (parsed_to, "/");
|
dequote (parsed_to, "/");
|
||||||
|
@ -1718,7 +1718,7 @@ bool Lexer::decomposePattern (
|
||||||
ignored.length ())
|
ignored.length ())
|
||||||
{
|
{
|
||||||
auto parsed_flags = text.substr (cursor);
|
auto parsed_flags = text.substr (cursor);
|
||||||
if (parsed_flags.find ("/") == std::string::npos)
|
if (parsed_flags.find ('/') == std::string::npos)
|
||||||
{
|
{
|
||||||
flags = parsed_flags;
|
flags = parsed_flags;
|
||||||
pattern = text.substr (1, cursor - 2 - flags.length ());
|
pattern = text.substr (1, cursor - 2 - flags.length ());
|
||||||
|
|
|
@ -279,7 +279,7 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
||||||
out += extra;
|
out += extra;
|
||||||
|
|
||||||
// Trim right.
|
// Trim right.
|
||||||
out.erase (out.find_last_not_of (" ") + 1);
|
out.erase (out.find_last_not_of (' ') + 1);
|
||||||
out += "\n";
|
out += "\n";
|
||||||
|
|
||||||
// Stop if the line limit is exceeded.
|
// Stop if the line limit is exceeded.
|
||||||
|
@ -365,7 +365,7 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
||||||
out += (odd ? extra_odd : extra_even);
|
out += (odd ? extra_odd : extra_even);
|
||||||
|
|
||||||
// Trim right.
|
// Trim right.
|
||||||
out.erase (out.find_last_not_of (" ") + 1);
|
out.erase (out.find_last_not_of (' ') + 1);
|
||||||
out += "\n";
|
out += "\n";
|
||||||
|
|
||||||
// Stop if the line limit is exceeded.
|
// Stop if the line limit is exceeded.
|
||||||
|
|
|
@ -500,7 +500,7 @@ int CmdInfo::execute (std::string& output)
|
||||||
if (end != std::string::npos)
|
if (end != std::string::npos)
|
||||||
{
|
{
|
||||||
auto uda = var.first.substr (12, end - 12);
|
auto uda = var.first.substr (12, end - 12);
|
||||||
auto dot = uda.find (".");
|
auto dot = uda.find ('.');
|
||||||
if (dot == std::string::npos)
|
if (dot == std::string::npos)
|
||||||
{
|
{
|
||||||
// urgency.uda.<name>.coefficient
|
// urgency.uda.<name>.coefficient
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue