diff options
Diffstat (limited to 'src/tools/clippy/src/docs/fn_address_comparisons.txt')
-rw-r--r-- | src/tools/clippy/src/docs/fn_address_comparisons.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/fn_address_comparisons.txt b/src/tools/clippy/src/docs/fn_address_comparisons.txt new file mode 100644 index 000000000..7d2b7b681 --- /dev/null +++ b/src/tools/clippy/src/docs/fn_address_comparisons.txt @@ -0,0 +1,17 @@ +### What it does +Checks for comparisons with an address of a function item. + +### Why is this bad? +Function item address is not guaranteed to be unique and could vary +between different code generation units. Furthermore different function items could have +the same address after being merged together. + +### Example +``` +type F = fn(); +fn a() {} +let f: F = a; +if f == a { + // ... +} +```
\ No newline at end of file |