mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-06 08:00:18 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
33 lines
848 B
HTML
33 lines
848 B
HTML
<html>
|
|
<body>
|
|
Reports unnecessary unary minuses. Such expressions might be hard to understand and might contain errors.
|
|
<p><b>For example:</b></p>
|
|
<pre><code>void unaryMinus(int i) {
|
|
int x = - -i;
|
|
}</code></pre>
|
|
<p>The following quick fixes are suggested here:</p>
|
|
<ul>
|
|
<li><p>Remove <code>-</code> operators before the <code>i</code> variable:</p>
|
|
<pre><code>void unaryMinus(int i) {
|
|
int x = i;
|
|
}</code></pre>
|
|
</li>
|
|
<li>
|
|
<p>Replace <code>-</code> operators with the prefix decrement operator:</p>
|
|
<pre><code>void unaryMinus(int i) {
|
|
int x = --i;
|
|
}</code></pre>
|
|
</li>
|
|
</ul>
|
|
|
|
<p><b>Another example:</b></p>
|
|
<pre><code>void unaryMinus(int i) {
|
|
i += - 8;
|
|
}</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>void unaryMinus(int i) {
|
|
i -= 8;
|
|
}</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |