Skip to content

Commit

Permalink
Explain why 'run-rustfix' is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
dvermd committed Oct 26, 2020
1 parent 8337c46 commit 6212950
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions tests/ui/ref_option_ref.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
22 changes: 11 additions & 11 deletions tests/ui/ref_option_ref.stderr
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
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>`
|
= 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>`
Expand Down

0 comments on commit 6212950

Please sign in to comment.