lloyAlloy on GitHub
identity_compare
Docs

identity_compare

Updated

== or ~= with a new payload variant or a new struct of a type that derives no Eq.

A payload variant, Item.Tool("a", 1), and a new struct are a new table. == on two tables compares identity, so a value built in the comparison equals no other: x == Item.Tool("a", 1) is always false, and ~= is always true. @derive(Eq) on the type writes an __eq that compares the payload or the fields. A unit variant is a string and compares by its text, so it does not fire. The lint reads the derives of a type the file declares or imports from the project.

Set its level in the [lint] table of alloy.toml, or for one file with --@alloy-lint.