Commit 7dc3d1bf authored by Paul's avatar Paul
Browse files

Add check for unnecessary else statement

parent 3ff10e1e
......@@ -243,6 +243,15 @@
<summary>The if statement is redundant.</summary>
</message>
</rule>
<rule>
<tokenlist>normal</tokenlist>
<pattern><![CDATA[if \( [^()]+ \) { [^{}]* (return|throw|break|continue) [^;]* ; } else {]]></pattern>
<message>
<id>UnnecessaryElseStatement</id>
<severity>style</severity>
<summary>Else statement is not necessary.</summary>
</message>
</rule>
<rule>
<tokenlist>normal</tokenlist>
<pattern><![CDATA[for \( \w+ (\w+) = \w+ ; \1 < \w+ ; (\1 \+\+|\+\+ \1|\1 \-\-|\-\- \1) \) { \w+ \[ \1 \] = \w+ \[ \1 \] ; }]]></pattern>
......
......@@ -35,10 +35,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
std::thread(std::move(task)).detach();
return std::move(fut);
}
else
{
return std::async(std::launch::deferred, std::forward<Function>(f));
}
return std::async(std::launch::deferred, std::forward<Function>(f));
}
struct auto_print
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment