A value is multiplied or divided by 1, or 0 is subtracted from it

tx0/kotlin:arithmetic-identitystrictwarningmaintainability/designdepth fastsmell

What it finds

x * 1, x / 1 and x - 0 give x. They are often left over from an edit, or stand for a factor that was meant to be something else. A leading 1 *, as in 1 * 60 * 1000, is a common way to write a unit and is left alone.

From the rule's source, useless_arithmetic.rs.

Example from the rule's tests
fun scale(x: Int, y: Double): Double {    val a = x * 1tx0 reports: multiplying by 1 gives the same value    val b = y / 1tx0 reports: dividing by 1 gives the same value    val c = x - 0tx0 reports: subtracting 0 gives the same value    return a + b + c + y * 1.5 + x / 2 + 1 / x}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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/kotlin:arithmetic-identity" = "warning"

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/kotlin:arithmetic-identity] reason="..."

tx0 explain tx0/kotlin:arithmetic-identity shows the same in the terminal. Found a false positive? Report it.