Skip to content

Commit c3b7c8e

Browse files
committed
fix test
1 parent 61ee047 commit c3b7c8e

11 files changed

+54
-41
lines changed

tests/ui-internal/unnecessary_symbol_str.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![feature(rustc_private)]
33
#![deny(clippy::internal)]
44
#![allow(
5+
clippy::borrow_deref_ref,
56
clippy::unnecessary_operation,
67
unused_must_use,
78
clippy::missing_clippy_version_attribute

tests/ui-internal/unnecessary_symbol_str.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![feature(rustc_private)]
33
#![deny(clippy::internal)]
44
#![allow(
5+
clippy::borrow_deref_ref,
56
clippy::unnecessary_operation,
67
unused_must_use,
78
clippy::missing_clippy_version_attribute

tests/ui-internal/unnecessary_symbol_str.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unnecessary `Symbol` to string conversion
2-
--> $DIR/unnecessary_symbol_str.rs:15:5
2+
--> $DIR/unnecessary_symbol_str.rs:16:5
33
|
44
LL | Symbol::intern("foo").as_str() == "clippy";
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Symbol::intern("foo") == rustc_span::sym::clippy`
@@ -12,25 +12,25 @@ LL | #![deny(clippy::internal)]
1212
= note: `#[deny(clippy::unnecessary_symbol_str)]` implied by `#[deny(clippy::internal)]`
1313

1414
error: unnecessary `Symbol` to string conversion
15-
--> $DIR/unnecessary_symbol_str.rs:16:5
15+
--> $DIR/unnecessary_symbol_str.rs:17:5
1616
|
1717
LL | Symbol::intern("foo").to_string() == "self";
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Symbol::intern("foo") == rustc_span::symbol::kw::SelfLower`
1919

2020
error: unnecessary `Symbol` to string conversion
21-
--> $DIR/unnecessary_symbol_str.rs:17:5
21+
--> $DIR/unnecessary_symbol_str.rs:18:5
2222
|
2323
LL | Symbol::intern("foo").to_ident_string() != "Self";
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Symbol::intern("foo") != rustc_span::symbol::kw::SelfUpper`
2525

2626
error: unnecessary `Symbol` to string conversion
27-
--> $DIR/unnecessary_symbol_str.rs:18:5
27+
--> $DIR/unnecessary_symbol_str.rs:19:5
2828
|
2929
LL | &*Ident::empty().as_str() == "clippy";
3030
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Ident::empty().name == rustc_span::sym::clippy`
3131

3232
error: unnecessary `Symbol` to string conversion
33-
--> $DIR/unnecessary_symbol_str.rs:19:5
33+
--> $DIR/unnecessary_symbol_str.rs:20:5
3434
|
3535
LL | "clippy" == Ident::empty().to_string();
3636
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::clippy == Ident::empty().name`

tests/ui/deref_by_slicing.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-rustfix
22

33
#![warn(clippy::deref_by_slicing)]
4+
#![allow(clippy::borrow_deref_ref)]
45

56
use std::io::Read;
67

tests/ui/deref_by_slicing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-rustfix
22

33
#![warn(clippy::deref_by_slicing)]
4+
#![allow(clippy::borrow_deref_ref)]
45

56
use std::io::Read;
67

tests/ui/deref_by_slicing.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
error: slicing when dereferencing would work
2-
--> $DIR/deref_by_slicing.rs:9:13
2+
--> $DIR/deref_by_slicing.rs:10:13
33
|
44
LL | let _ = &vec[..];
55
| ^^^^^^^^ help: dereference the original value instead: `&*vec`
66
|
77
= note: `-D clippy::deref-by-slicing` implied by `-D warnings`
88

99
error: slicing when dereferencing would work
10-
--> $DIR/deref_by_slicing.rs:10:13
10+
--> $DIR/deref_by_slicing.rs:11:13
1111
|
1212
LL | let _ = &mut vec[..];
1313
| ^^^^^^^^^^^^ help: dereference the original value instead: `&mut *vec`
1414

1515
error: slicing when dereferencing would work
16-
--> $DIR/deref_by_slicing.rs:13:13
16+
--> $DIR/deref_by_slicing.rs:14:13
1717
|
1818
LL | let _ = &ref_vec[..];
1919
| ^^^^^^^^^^^^ help: dereference the original value instead: `&**ref_vec`
2020

2121
error: slicing when dereferencing would work
22-
--> $DIR/deref_by_slicing.rs:14:21
22+
--> $DIR/deref_by_slicing.rs:15:21
2323
|
2424
LL | let mut_slice = &mut ref_vec[..];
2525
| ^^^^^^^^^^^^^^^^ help: dereference the original value instead: `&mut **ref_vec`
2626

2727
error: slicing when dereferencing would work
28-
--> $DIR/deref_by_slicing.rs:15:13
28+
--> $DIR/deref_by_slicing.rs:16:13
2929
|
3030
LL | let _ = &mut mut_slice[..]; // Err, re-borrows slice
3131
| ^^^^^^^^^^^^^^^^^^ help: reborrow the original value instead: `&mut *mut_slice`
3232

3333
error: slicing when dereferencing would work
34-
--> $DIR/deref_by_slicing.rs:18:13
34+
--> $DIR/deref_by_slicing.rs:19:13
3535
|
3636
LL | let _ = &s[..];
3737
| ^^^^^^ help: dereference the original value instead: `&*s`
3838

3939
error: slicing when dereferencing would work
40-
--> $DIR/deref_by_slicing.rs:21:18
40+
--> $DIR/deref_by_slicing.rs:22:18
4141
|
4242
LL | let _ = &mut &S[..]; // Err, re-borrows slice
4343
| ^^^^^^ help: reborrow the original value instead: `&*S`
4444

4545
error: slicing when dereferencing would work
46-
--> $DIR/deref_by_slicing.rs:25:13
46+
--> $DIR/deref_by_slicing.rs:26:13
4747
|
4848
LL | let _ = &slice_ref[..]; // Err, derefs slice
4949
| ^^^^^^^^^^^^^^ help: dereference the original value instead: `*slice_ref`
5050

5151
error: slicing when dereferencing would work
52-
--> $DIR/deref_by_slicing.rs:28:13
52+
--> $DIR/deref_by_slicing.rs:29:13
5353
|
5454
LL | let _ = (&bytes[..]).read_to_end(&mut vec![]).unwrap(); // Err, re-borrows slice
5555
| ^^^^^^^^^^^^ help: reborrow the original value instead: `(&*bytes)`

tests/ui/explicit_deref_methods.fixed

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// run-rustfix
22

3-
#![allow(unused_variables, clippy::clone_double_ref, clippy::needless_borrow)]
4-
#![allow(clippy::borrow_deref_ref)]
3+
#![allow(
4+
unused_variables,
5+
clippy::clone_double_ref,
6+
clippy::needless_borrow,
7+
clippy::borrow_deref_ref
8+
)]
59
#![warn(clippy::explicit_deref_methods)]
610

711
use std::ops::{Deref, DerefMut};

tests/ui/explicit_deref_methods.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// run-rustfix
22

3-
#![allow(unused_variables, clippy::clone_double_ref, clippy::needless_borrow)]
4-
#![allow(clippy::borrow_deref_ref)]
3+
#![allow(
4+
unused_variables,
5+
clippy::clone_double_ref,
6+
clippy::needless_borrow,
7+
clippy::borrow_deref_ref
8+
)]
59
#![warn(clippy::explicit_deref_methods)]
610

711
use std::ops::{Deref, DerefMut};

tests/ui/explicit_deref_methods.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
error: explicit `deref` method call
2-
--> $DIR/explicit_deref_methods.rs:32:19
2+
--> $DIR/explicit_deref_methods.rs:35:19
33
|
44
LL | let b: &str = a.deref();
55
| ^^^^^^^^^ help: try this: `&*a`
66
|
77
= note: `-D clippy::explicit-deref-methods` implied by `-D warnings`
88

99
error: explicit `deref_mut` method call
10-
--> $DIR/explicit_deref_methods.rs:34:23
10+
--> $DIR/explicit_deref_methods.rs:37:23
1111
|
1212
LL | let b: &mut str = a.deref_mut();
1313
| ^^^^^^^^^^^^^ help: try this: `&mut **a`
1414

1515
error: explicit `deref` method call
16-
--> $DIR/explicit_deref_methods.rs:37:39
16+
--> $DIR/explicit_deref_methods.rs:40:39
1717
|
1818
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
1919
| ^^^^^^^^^ help: try this: `&*a`
2020

2121
error: explicit `deref` method call
22-
--> $DIR/explicit_deref_methods.rs:37:50
22+
--> $DIR/explicit_deref_methods.rs:40:50
2323
|
2424
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
2525
| ^^^^^^^^^ help: try this: `&*a`
2626

2727
error: explicit `deref` method call
28-
--> $DIR/explicit_deref_methods.rs:39:20
28+
--> $DIR/explicit_deref_methods.rs:42:20
2929
|
3030
LL | println!("{}", a.deref());
3131
| ^^^^^^^^^ help: try this: `&*a`
3232

3333
error: explicit `deref` method call
34-
--> $DIR/explicit_deref_methods.rs:42:11
34+
--> $DIR/explicit_deref_methods.rs:45:11
3535
|
3636
LL | match a.deref() {
3737
| ^^^^^^^^^ help: try this: `&*a`
3838

3939
error: explicit `deref` method call
40-
--> $DIR/explicit_deref_methods.rs:46:28
40+
--> $DIR/explicit_deref_methods.rs:49:28
4141
|
4242
LL | let b: String = concat(a.deref());
4343
| ^^^^^^^^^ help: try this: `&*a`
4444

4545
error: explicit `deref` method call
46-
--> $DIR/explicit_deref_methods.rs:48:13
46+
--> $DIR/explicit_deref_methods.rs:51:13
4747
|
4848
LL | let b = just_return(a).deref();
4949
| ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `just_return(a)`
5050

5151
error: explicit `deref` method call
52-
--> $DIR/explicit_deref_methods.rs:50:28
52+
--> $DIR/explicit_deref_methods.rs:53:28
5353
|
5454
LL | let b: String = concat(just_return(a).deref());
5555
| ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `just_return(a)`
5656

5757
error: explicit `deref` method call
58-
--> $DIR/explicit_deref_methods.rs:52:19
58+
--> $DIR/explicit_deref_methods.rs:55:19
5959
|
6060
LL | let b: &str = a.deref().deref();
6161
| ^^^^^^^^^^^^^^^^^ help: try this: `&**a`
6262

6363
error: explicit `deref` method call
64-
--> $DIR/explicit_deref_methods.rs:55:13
64+
--> $DIR/explicit_deref_methods.rs:58:13
6565
|
6666
LL | let b = opt_a.unwrap().deref();
6767
| ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&*opt_a.unwrap()`
6868

6969
error: explicit `deref` method call
70-
--> $DIR/explicit_deref_methods.rs:81:31
70+
--> $DIR/explicit_deref_methods.rs:84:31
7171
|
7272
LL | let b: &str = expr_deref!(a.deref());
7373
| ^^^^^^^^^ help: try this: `&*a`

tests/ui/recursive_format_impl.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#![allow(
33
clippy::inherent_to_string_shadow_display,
44
clippy::to_string_in_format_args,
5-
clippy::deref_addrof
5+
clippy::deref_addrof,
6+
clippy::borrow_deref_ref
67
)]
78

89
use std::fmt;

tests/ui/recursive_format_impl.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
11
error: using `self.to_string` in `fmt::Display` implementation will cause infinite recursion
2-
--> $DIR/recursive_format_impl.rs:29:25
2+
--> $DIR/recursive_format_impl.rs:30:25
33
|
44
LL | write!(f, "{}", self.to_string())
55
| ^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::recursive-format-impl` implied by `-D warnings`
88

99
error: using `self` as `Display` in `impl Display` will cause infinite recursion
10-
--> $DIR/recursive_format_impl.rs:73:9
10+
--> $DIR/recursive_format_impl.rs:74:9
1111
|
1212
LL | write!(f, "{}", self)
1313
| ^^^^^^^^^^^^^^^^^^^^^
1414
|
1515
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error: using `self` as `Display` in `impl Display` will cause infinite recursion
18-
--> $DIR/recursive_format_impl.rs:82:9
18+
--> $DIR/recursive_format_impl.rs:83:9
1919
|
2020
LL | write!(f, "{}", &self)
2121
| ^^^^^^^^^^^^^^^^^^^^^^
2222
|
2323
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
2424

2525
error: using `self` as `Debug` in `impl Debug` will cause infinite recursion
26-
--> $DIR/recursive_format_impl.rs:88:9
26+
--> $DIR/recursive_format_impl.rs:89:9
2727
|
2828
LL | write!(f, "{:?}", &self)
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^
3030
|
3131
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
3232

3333
error: using `self` as `Display` in `impl Display` will cause infinite recursion
34-
--> $DIR/recursive_format_impl.rs:97:9
34+
--> $DIR/recursive_format_impl.rs:98:9
3535
|
3636
LL | write!(f, "{}", &&&self)
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^
3838
|
3939
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
4040

4141
error: using `self` as `Display` in `impl Display` will cause infinite recursion
42-
--> $DIR/recursive_format_impl.rs:171:9
42+
--> $DIR/recursive_format_impl.rs:172:9
4343
|
4444
LL | write!(f, "{}", &*self)
4545
| ^^^^^^^^^^^^^^^^^^^^^^^
4646
|
4747
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
4848

4949
error: using `self` as `Debug` in `impl Debug` will cause infinite recursion
50-
--> $DIR/recursive_format_impl.rs:177:9
50+
--> $DIR/recursive_format_impl.rs:178:9
5151
|
5252
LL | write!(f, "{:?}", &*self)
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5454
|
5555
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
5656

5757
error: using `self` as `Display` in `impl Display` will cause infinite recursion
58-
--> $DIR/recursive_format_impl.rs:193:9
58+
--> $DIR/recursive_format_impl.rs:194:9
5959
|
6060
LL | write!(f, "{}", *self)
6161
| ^^^^^^^^^^^^^^^^^^^^^^
6262
|
6363
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
6464

6565
error: using `self` as `Display` in `impl Display` will cause infinite recursion
66-
--> $DIR/recursive_format_impl.rs:209:9
66+
--> $DIR/recursive_format_impl.rs:210:9
6767
|
6868
LL | write!(f, "{}", **&&*self)
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
7070
|
7171
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
7272

7373
error: using `self` as `Display` in `impl Display` will cause infinite recursion
74-
--> $DIR/recursive_format_impl.rs:225:9
74+
--> $DIR/recursive_format_impl.rs:226:9
7575
|
7676
LL | write!(f, "{}", &&**&&*self)
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)