blob: 35535bd4fddd01f99eb04b6d8d6a365b4f0fff86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use std::fmt::Debug;
use std::ptr;
use std::rc::Rc;
use std::sync::Arc;
fn a() {}
#[warn(clippy::fn_address_comparisons)]
fn main() {
type F = fn();
let f: F = a;
let g: F = f;
// These should fail:
let _ = f == a;
//~^ ERROR: comparing with a non-unique address of a function item
//~| NOTE: `-D clippy::fn-address-comparisons` implied by `-D warnings`
let _ = f != a;
//~^ ERROR: comparing with a non-unique address of a function item
// These should be fine:
let _ = f == g;
}
|