summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/fn_address_comparisons.rs
blob: 362dcb4fd80ca350d3220060fe1139786b68754f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
    let _ = f != a;

    // These should be fine:
    let _ = f == g;
}