summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/unnecessary_ref.fixed
blob: d927bae976f799e05c567c1e02467e813a563a1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// run-rustfix

#![feature(stmt_expr_attributes)]
#![allow(unused_variables, dead_code)]

struct Outer {
    inner: u32,
}

#[deny(clippy::ref_in_deref)]
fn main() {
    let outer = Outer { inner: 0 };
    let inner = outer.inner;
}

struct Apple;
impl Apple {
    fn hello(&self) {}
}
struct Package(pub *const Apple);
fn foobar(package: *const Package) {
    unsafe { &*(*package).0 }.hello();
}