The step of a for loop increments an iterator with it++, which copies the iterator for a value nobody uses

tx0/cpp:postfix-increment-of-iteratorstrictnoteperformance/algorithmicdepth fastperformance

What it finds

Postfix ++ on a class type returns the old value, so it copies the iterator; in the step of a loop the copy is thrown away. Prefix ++it does the same without the copy. The fix rewrites the step. Iterators are recognised by a declaration that names an iterator type or starts from begin().

From the rule's source, postfix_increment_of_iterator.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:postfix-increment-of-iterator" = "note"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:postfix-increment-of-iterator] reason="..."

tx0 explain tx0/cpp:postfix-increment-of-iterator shows the same in the terminal. Found a false positive? Report it.