Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/ui/ref_as_ptr.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::ref_as_ptr)]
#![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)]
#![allow(clippy::unnecessary_mut_passed)]

fn f<T>(_: T) {}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/ref_as_ptr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::ref_as_ptr)]
#![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)]
#![allow(clippy::unnecessary_mut_passed)]

fn f<T>(_: T) {}

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/ref_binding_to_reference.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// FIXME: run-rustfix waiting on multi-span suggestions
//@no-rustfix
#![warn(clippy::ref_binding_to_reference)]
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]
#![expect(clippy::explicit_auto_deref, clippy::needless_borrowed_reference)]

fn f1(_: &str) {}
macro_rules! m2 {
Expand All @@ -15,7 +15,6 @@ macro_rules! m3 {
};
}

#[allow(dead_code)]
fn main() {
let x = String::new();

Expand Down
14 changes: 7 additions & 7 deletions tests/ui/ref_binding_to_reference.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:30:14
--> tests/ui/ref_binding_to_reference.rs:29:14
|
LL | Some(ref x) => x,
| ^^^^^
Expand All @@ -13,7 +13,7 @@ LL + Some(x) => &x,
|

error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:37:14
--> tests/ui/ref_binding_to_reference.rs:36:14
|
LL | Some(ref x) => {
| ^^^^^
Expand All @@ -29,7 +29,7 @@ LL ~ &x
|

error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:49:14
--> tests/ui/ref_binding_to_reference.rs:48:14
|
LL | Some(ref x) => m2!(x),
| ^^^^^
Expand All @@ -41,7 +41,7 @@ LL + Some(x) => m2!(&x),
|

error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:55:15
--> tests/ui/ref_binding_to_reference.rs:54:15
|
LL | let _ = |&ref x: &&String| {
| ^^^^^
Expand All @@ -55,7 +55,7 @@ LL ~ let _: &&String = &x;
|

error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:63:12
--> tests/ui/ref_binding_to_reference.rs:62:12
|
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
| ^^^^^
Expand All @@ -70,7 +70,7 @@ LL ~ x
|

error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:72:11
--> tests/ui/ref_binding_to_reference.rs:71:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^
Expand All @@ -84,7 +84,7 @@ LL ~ let _: &&String = &x;
|

error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:82:11
--> tests/ui/ref_binding_to_reference.rs:81:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/ref_option_ref.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(unused)]
#![warn(clippy::ref_option_ref)]
//@no-rustfix
// This lint is not tagged as run-rustfix because automatically
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,5 +1,5 @@
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:10:23
--> tests/ui/ref_option_ref.rs:9:23
|
LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD);
| ^^^^^^^^^^^^^ help: try: `Option<&i32>`
Expand All @@ -8,61 +8,61 @@ LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD);
= help: to override `-D warnings` add `#[allow(clippy::ref_option_ref)]`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:14:18
--> tests/ui/ref_option_ref.rs:13:18
|
LL | const REF_CONST: &Option<&i32> = &Some(CONST_THRESHOLD);
| ^^^^^^^^^^^^^ help: try: `Option<&i32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:17:25
--> tests/ui/ref_option_ref.rs:16:25
|
LL | type RefOptRefU32<'a> = &'a Option<&'a u32>;
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:20:25
--> tests/ui/ref_option_ref.rs:19:25
|
LL | type RefOptRef<'a, T> = &'a Option<&'a T>;
| ^^^^^^^^^^^^^^^^^ help: try: `Option<&'a T>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:23:14
--> tests/ui/ref_option_ref.rs:22:14
|
LL | fn foo(data: &Option<&u32>) {}
| ^^^^^^^^^^^^^ help: try: `Option<&u32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:26:23
--> tests/ui/ref_option_ref.rs:25:23
|
LL | fn bar(data: &u32) -> &Option<&u32> {
| ^^^^^^^^^^^^^ help: try: `Option<&u32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:33:11
--> tests/ui/ref_option_ref.rs:32:11
|
LL | data: &'a Option<&'a u32>,
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:37:32
--> tests/ui/ref_option_ref.rs:36:32
|
LL | struct StructTupleRef<'a>(u32, &'a Option<&'a u32>);
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:42:14
--> tests/ui/ref_option_ref.rs:41:14
|
LL | Variant2(&'a Option<&'a u32>),
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:52:14
--> tests/ui/ref_option_ref.rs:51:14
|
LL | type A = &'static Option<&'static Self>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'static Self>`

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
--> tests/ui/ref_option_ref.rs:59:12
--> tests/ui/ref_option_ref.rs:58:12
|
LL | let x: &Option<&u32> = &None;
| ^^^^^^^^^^^^^ help: try: `Option<&u32>`
Expand Down
1 change: 0 additions & 1 deletion tests/ui/ref_patterns.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(unused)]
#![warn(clippy::ref_patterns)]

fn use_in_pattern() {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/ref_patterns.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: usage of ref pattern
--> tests/ui/ref_patterns.rs:8:14
--> tests/ui/ref_patterns.rs:7:14
|
LL | Some(ref opt) => {},
| ^^^^^^^
Expand All @@ -9,15 +9,15 @@ LL | Some(ref opt) => {},
= help: to override `-D warnings` add `#[allow(clippy::ref_patterns)]`

error: usage of ref pattern
--> tests/ui/ref_patterns.rs:15:9
--> tests/ui/ref_patterns.rs:14:9
|
LL | let ref y = x;
| ^^^^^
|
= help: consider using `&` for clarity instead

error: usage of ref pattern
--> tests/ui/ref_patterns.rs:19:21
--> tests/ui/ref_patterns.rs:18:21
|
LL | fn use_in_parameter(ref x: i32) {}
| ^^^^^
Expand Down
10 changes: 2 additions & 8 deletions tests/ui/regex.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
//@require-annotations-for-level: WARN
#![allow(
unused,
clippy::needless_raw_strings,
clippy::needless_raw_string_hashes,
clippy::needless_borrow,
clippy::needless_borrows_for_generic_args
)]
#![warn(clippy::invalid_regex, clippy::trivial_regex, clippy::regex_creation_in_loops)]
#![warn(clippy::invalid_regex, clippy::regex_creation_in_loops, clippy::trivial_regex)]
#![expect(clippy::needless_borrows_for_generic_args)]

extern crate regex;

Expand Down
Loading