diff --git a/tests/ui/ref_option_ref.rs b/tests/ui/ref_option_ref.rs index 3c4def272f7b..b2c275d68afa 100644 --- a/tests/ui/ref_option_ref.rs +++ b/tests/ui/ref_option_ref.rs @@ -1,6 +1,11 @@ #![allow(unused)] #![warn(clippy::ref_option_ref)] +// This lint is not tagged as run-rustfix because automatically +// changing the type of a variable would also means changing +// all usages of this variable to match and This is not handled +// by this lint. + static THRESHOLD: i32 = 10; static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD); const CONST_THRESHOLD: &i32 = &10; diff --git a/tests/ui/ref_option_ref.stderr b/tests/ui/ref_option_ref.stderr index 16c1de19bb69..10f196612682 100644 --- a/tests/ui/ref_option_ref.stderr +++ b/tests/ui/ref_option_ref.stderr @@ -1,5 +1,5 @@ error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:5:23 + --> $DIR/ref_option_ref.rs:10:23 | LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD); | ^^^^^^^^^^^^^ help: try: `Option<&i32>` @@ -7,61 +7,61 @@ LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD); = note: `-D clippy::ref-option-ref` implied by `-D warnings` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:7:18 + --> $DIR/ref_option_ref.rs:12:18 | LL | const REF_CONST: &Option<&i32> = &Some(&CONST_THRESHOLD); | ^^^^^^^^^^^^^ help: try: `Option<&i32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:9:25 + --> $DIR/ref_option_ref.rs:14:25 | LL | type RefOptRefU32<'a> = &'a Option<&'a u32>; | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:10:25 + --> $DIR/ref_option_ref.rs:15:25 | LL | type RefOptRef<'a, T> = &'a Option<&'a T>; | ^^^^^^^^^^^^^^^^^ help: try: `Option<&'a T>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:12:14 + --> $DIR/ref_option_ref.rs:17:14 | LL | fn foo(data: &Option<&u32>) {} | ^^^^^^^^^^^^^ help: try: `Option<&u32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:14:23 + --> $DIR/ref_option_ref.rs:19:23 | LL | fn bar(data: &u32) -> &Option<&u32> { | ^^^^^^^^^^^^^ help: try: `Option<&u32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:19:11 + --> $DIR/ref_option_ref.rs:24:11 | LL | data: &'a Option<&'a u32>, | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:22:32 + --> $DIR/ref_option_ref.rs:27:32 | LL | struct StructTupleRef<'a>(u32, &'a Option<&'a u32>); | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:26:14 + --> $DIR/ref_option_ref.rs:31:14 | LL | Variant2(&'a Option<&'a u32>), | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:35:14 + --> $DIR/ref_option_ref.rs:40:14 | LL | type A = &'static Option<&'static Self>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'static Self>` error: since & implements Copy trait, &Option<&T> can be simplifyied into Option<&T> - --> $DIR/ref_option_ref.rs:41:12 + --> $DIR/ref_option_ref.rs:46:12 | LL | let x: &Option<&u32> = &None; | ^^^^^^^^^^^^^ help: try: `Option<&u32>`