fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
731 B31 linesraw
1fn fn_pointer_static() -> usize {
2    static FN: fn() -> usize = || 1;
3    
4    FN() + 1
5    //~^ ERROR: returning the result of a `let` binding from a block
6    //~| NOTE: `-D clippy::let-and-return` implied by `-D warnings`
7}
8
9fn fn_pointer_const() -> usize {
10    const FN: fn() -> usize = || 1;
11    
12    FN() + 1
13    //~^ ERROR: returning the result of a `let` binding from a block
14}
15
16fn deref_to_dyn_fn() -> usize {
17    struct Derefs;
18    impl std::ops::Deref for Derefs {
19        type Target = dyn Fn() -> usize;
20
21        fn deref(&self) -> &Self::Target {
22            &|| 2
23        }
24    }
25    static FN: Derefs = Derefs;
26    
27    FN() + 1
28    //~^ ERROR: returning the result of a `let` binding from a block
29}
30
31fn main() {}