]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/ref_option_ref.rs
2 #![warn(clippy::ref_option_ref)]
4 // This lint is not tagged as run-rustfix because automatically
5 // changing the type of a variable would also means changing
6 // all usages of this variable to match and This is not handled
9 static THRESHOLD
: i32 = 10;
10 static REF_THRESHOLD
: &Option
<&i32> = &Some(&THRESHOLD
);
11 const CONST_THRESHOLD
: &i32 = &10;
12 const REF_CONST
: &Option
<&i32> = &Some(&CONST_THRESHOLD
);
14 type RefOptRefU32
<'a
> = &'a Option
<&'a
u32>;
15 type RefOptRef
<'a
, T
> = &'a Option
<&'a T
>;
17 fn foo(data
: &Option
<&u32>) {}
19 fn bar(data
: &u32) -> &Option
<&u32> {
23 struct StructRef
<'a
> {
24 data
: &'a Option
<&'a
u32>,
27 struct StructTupleRef
<'a
>(u32, &'a Option
<&'a
u32>);
31 Variant2(&'a Option
<&'a
u32>),
36 fn foo(&self, _
: Self::A
);
39 impl RefOptTrait
for u32 {
40 type A
= &'
static Option
<&'
static Self>;
42 fn foo(&self, _
: Self::A
) {}
46 let x
: &Option
<&u32> = &None
;