RS.CLIPPY.SUSPICIOUS_XOR_USED_AS_POW

XOR (`^`) operator possibly used as exponentiation operator

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: suspicious_xor_used_as_pow. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Warns for a Bitwise XOR (^) operator being probably confused as a powering. It will not trigger if any of the numbers are not in decimal.

Why restrict this?

It's most probably a typo and may lead to unexpected behaviours.

Example

let x = 3_i32 ^ 4_i32;

Use instead:

let x = 3_i32.pow(4);