Skip to content

Commit c663d2f

Browse files
committed
Fix tests
1 parent 2555adc commit c663d2f

8 files changed

+48
-43
lines changed

tests/ui/assigning_clones.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn owned_method_val(mut mut_string: String, ref_str: &str) {
139139
}
140140

141141
struct HasDeref {
142-
a: String
142+
a: String,
143143
}
144144

145145
impl Deref for HasDeref {

tests/ui/field_reassign_with_default.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//@aux-build:proc_macros.rs
33

44
#![warn(clippy::field_reassign_with_default)]
5+
#![allow(clippy::assigning_clones)]
56

67
#[macro_use]
78
extern crate proc_macro_derive;

tests/ui/field_reassign_with_default.stderr

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,133 @@
11
error: field assignment outside of initializer for an instance created with Default::default()
2-
--> $DIR/field_reassign_with_default.rs:56:5
2+
--> $DIR/field_reassign_with_default.rs:57:5
33
|
44
LL | a.i = 42;
55
| ^^^^^^^^^
66
|
77
note: consider initializing the variable with `main::A { i: 42, ..Default::default() }` and removing relevant reassignments
8-
--> $DIR/field_reassign_with_default.rs:55:5
8+
--> $DIR/field_reassign_with_default.rs:56:5
99
|
1010
LL | let mut a: A = Default::default();
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
1313
= help: to override `-D warnings` add `#[allow(clippy::field_reassign_with_default)]`
1414

1515
error: field assignment outside of initializer for an instance created with Default::default()
16-
--> $DIR/field_reassign_with_default.rs:96:5
16+
--> $DIR/field_reassign_with_default.rs:97:5
1717
|
1818
LL | a.j = 43;
1919
| ^^^^^^^^^
2020
|
2121
note: consider initializing the variable with `main::A { j: 43, i: 42 }` and removing relevant reassignments
22-
--> $DIR/field_reassign_with_default.rs:95:5
22+
--> $DIR/field_reassign_with_default.rs:96:5
2323
|
2424
LL | let mut a: A = Default::default();
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2626

2727
error: field assignment outside of initializer for an instance created with Default::default()
28-
--> $DIR/field_reassign_with_default.rs:101:5
28+
--> $DIR/field_reassign_with_default.rs:102:5
2929
|
3030
LL | a.i = 42;
3131
| ^^^^^^^^^
3232
|
3333
note: consider initializing the variable with `main::A { i: 42, j: 44 }` and removing relevant reassignments
34-
--> $DIR/field_reassign_with_default.rs:100:5
34+
--> $DIR/field_reassign_with_default.rs:101:5
3535
|
3636
LL | let mut a: A = Default::default();
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838

3939
error: field assignment outside of initializer for an instance created with Default::default()
40-
--> $DIR/field_reassign_with_default.rs:107:5
40+
--> $DIR/field_reassign_with_default.rs:108:5
4141
|
4242
LL | a.i = 42;
4343
| ^^^^^^^^^
4444
|
4545
note: consider initializing the variable with `main::A { i: 42, ..Default::default() }` and removing relevant reassignments
46-
--> $DIR/field_reassign_with_default.rs:106:5
46+
--> $DIR/field_reassign_with_default.rs:107:5
4747
|
4848
LL | let mut a = A::default();
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5050

5151
error: field assignment outside of initializer for an instance created with Default::default()
52-
--> $DIR/field_reassign_with_default.rs:117:5
52+
--> $DIR/field_reassign_with_default.rs:118:5
5353
|
5454
LL | a.i = Default::default();
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5656
|
5757
note: consider initializing the variable with `main::A { i: Default::default(), ..Default::default() }` and removing relevant reassignments
58-
--> $DIR/field_reassign_with_default.rs:116:5
58+
--> $DIR/field_reassign_with_default.rs:117:5
5959
|
6060
LL | let mut a: A = Default::default();
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6262

6363
error: field assignment outside of initializer for an instance created with Default::default()
64-
--> $DIR/field_reassign_with_default.rs:121:5
64+
--> $DIR/field_reassign_with_default.rs:122:5
6565
|
6666
LL | a.i = Default::default();
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6868
|
6969
note: consider initializing the variable with `main::A { i: Default::default(), j: 45 }` and removing relevant reassignments
70-
--> $DIR/field_reassign_with_default.rs:120:5
70+
--> $DIR/field_reassign_with_default.rs:121:5
7171
|
7272
LL | let mut a: A = Default::default();
7373
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7474

7575
error: field assignment outside of initializer for an instance created with Default::default()
76-
--> $DIR/field_reassign_with_default.rs:143:5
76+
--> $DIR/field_reassign_with_default.rs:144:5
7777
|
7878
LL | a.i = vec![1];
7979
| ^^^^^^^^^^^^^^
8080
|
8181
note: consider initializing the variable with `C { i: vec![1], ..Default::default() }` and removing relevant reassignments
82-
--> $DIR/field_reassign_with_default.rs:142:5
82+
--> $DIR/field_reassign_with_default.rs:143:5
8383
|
8484
LL | let mut a: C = C::default();
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8686

8787
error: field assignment outside of initializer for an instance created with Default::default()
88-
--> $DIR/field_reassign_with_default.rs:161:5
88+
--> $DIR/field_reassign_with_default.rs:162:5
8989
|
9090
LL | a.i = true;
9191
| ^^^^^^^^^^^
9292
|
9393
note: consider initializing the variable with `Wrapper::<bool> { i: true }` and removing relevant reassignments
94-
--> $DIR/field_reassign_with_default.rs:160:5
94+
--> $DIR/field_reassign_with_default.rs:161:5
9595
|
9696
LL | let mut a: Wrapper<bool> = Default::default();
9797
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9898

9999
error: field assignment outside of initializer for an instance created with Default::default()
100-
--> $DIR/field_reassign_with_default.rs:164:5
100+
--> $DIR/field_reassign_with_default.rs:165:5
101101
|
102102
LL | a.i = 42;
103103
| ^^^^^^^^^
104104
|
105105
note: consider initializing the variable with `WrapperMulti::<i32, i64> { i: 42, ..Default::default() }` and removing relevant reassignments
106-
--> $DIR/field_reassign_with_default.rs:163:5
106+
--> $DIR/field_reassign_with_default.rs:164:5
107107
|
108108
LL | let mut a: WrapperMulti<i32, i64> = Default::default();
109109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110

111111
error: field assignment outside of initializer for an instance created with Default::default()
112-
--> $DIR/field_reassign_with_default.rs:235:13
112+
--> $DIR/field_reassign_with_default.rs:236:13
113113
|
114114
LL | f.name = name.len();
115115
| ^^^^^^^^^^^^^^^^^^^^
116116
|
117117
note: consider initializing the variable with `issue6312::ImplDropAllCopy { name: name.len(), ..Default::default() }` and removing relevant reassignments
118-
--> $DIR/field_reassign_with_default.rs:234:13
118+
--> $DIR/field_reassign_with_default.rs:235:13
119119
|
120120
LL | let mut f = ImplDropAllCopy::default();
121121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122122

123123
error: field assignment outside of initializer for an instance created with Default::default()
124-
--> $DIR/field_reassign_with_default.rs:251:13
124+
--> $DIR/field_reassign_with_default.rs:252:13
125125
|
126126
LL | f.name = name.len();
127127
| ^^^^^^^^^^^^^^^^^^^^
128128
|
129129
note: consider initializing the variable with `issue6312::NoDropAllCopy { name: name.len(), ..Default::default() }` and removing relevant reassignments
130-
--> $DIR/field_reassign_with_default.rs:250:13
130+
--> $DIR/field_reassign_with_default.rs:251:13
131131
|
132132
LL | let mut f = NoDropAllCopy::default();
133133
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/manual_memcpy/without_loop_counters.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![warn(clippy::needless_range_loop, clippy::manual_memcpy)]
22
#![allow(clippy::useless_vec)]
3+
#![allow(clippy::assigning_clones)]
4+
35
//@no-rustfix
46
const LOOP_OFFSET: usize = 5000;
57

tests/ui/manual_memcpy/without_loop_counters.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: it looks like you're manually copying between slices
2-
--> $DIR/without_loop_counters.rs:8:5
2+
--> $DIR/without_loop_counters.rs:10:5
33
|
44
LL | / for i in 0..src.len() {
55
LL | |
@@ -12,7 +12,7 @@ LL | | }
1212
= help: to override `-D warnings` add `#[allow(clippy::manual_memcpy)]`
1313

1414
error: it looks like you're manually copying between slices
15-
--> $DIR/without_loop_counters.rs:15:5
15+
--> $DIR/without_loop_counters.rs:17:5
1616
|
1717
LL | / for i in 0..src.len() {
1818
LL | |
@@ -21,7 +21,7 @@ LL | | }
2121
| |_____^ help: try replacing the loop by: `dst[10..(src.len() + 10)].copy_from_slice(&src[..]);`
2222

2323
error: it looks like you're manually copying between slices
24-
--> $DIR/without_loop_counters.rs:21:5
24+
--> $DIR/without_loop_counters.rs:23:5
2525
|
2626
LL | / for i in 0..src.len() {
2727
LL | |
@@ -30,7 +30,7 @@ LL | | }
3030
| |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[10..(src.len() + 10)]);`
3131

3232
error: it looks like you're manually copying between slices
33-
--> $DIR/without_loop_counters.rs:27:5
33+
--> $DIR/without_loop_counters.rs:29:5
3434
|
3535
LL | / for i in 11..src.len() {
3636
LL | |
@@ -39,7 +39,7 @@ LL | | }
3939
| |_____^ help: try replacing the loop by: `dst[11..src.len()].copy_from_slice(&src[(11 - 10)..(src.len() - 10)]);`
4040

4141
error: it looks like you're manually copying between slices
42-
--> $DIR/without_loop_counters.rs:33:5
42+
--> $DIR/without_loop_counters.rs:35:5
4343
|
4444
LL | / for i in 0..dst.len() {
4545
LL | |
@@ -48,7 +48,7 @@ LL | | }
4848
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..dst.len()]);`
4949

5050
error: it looks like you're manually copying between slices
51-
--> $DIR/without_loop_counters.rs:47:5
51+
--> $DIR/without_loop_counters.rs:49:5
5252
|
5353
LL | / for i in 10..256 {
5454
LL | |
@@ -64,7 +64,7 @@ LL + dst2[(10 + 500)..(256 + 500)].copy_from_slice(&src[10..256]);
6464
|
6565

6666
error: it looks like you're manually copying between slices
67-
--> $DIR/without_loop_counters.rs:60:5
67+
--> $DIR/without_loop_counters.rs:62:5
6868
|
6969
LL | / for i in 10..LOOP_OFFSET {
7070
LL | |
@@ -73,7 +73,7 @@ LL | | }
7373
| |_____^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].copy_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)]);`
7474

7575
error: it looks like you're manually copying between slices
76-
--> $DIR/without_loop_counters.rs:74:5
76+
--> $DIR/without_loop_counters.rs:76:5
7777
|
7878
LL | / for i in 0..src_vec.len() {
7979
LL | |
@@ -82,7 +82,7 @@ LL | | }
8282
| |_____^ help: try replacing the loop by: `dst_vec[..src_vec.len()].copy_from_slice(&src_vec[..]);`
8383

8484
error: it looks like you're manually copying between slices
85-
--> $DIR/without_loop_counters.rs:104:5
85+
--> $DIR/without_loop_counters.rs:106:5
8686
|
8787
LL | / for i in from..from + src.len() {
8888
LL | |
@@ -91,7 +91,7 @@ LL | | }
9191
| |_____^ help: try replacing the loop by: `dst[from..(from + src.len())].copy_from_slice(&src[..(from + src.len() - from)]);`
9292

9393
error: it looks like you're manually copying between slices
94-
--> $DIR/without_loop_counters.rs:109:5
94+
--> $DIR/without_loop_counters.rs:111:5
9595
|
9696
LL | / for i in from..from + 3 {
9797
LL | |
@@ -100,7 +100,7 @@ LL | | }
100100
| |_____^ help: try replacing the loop by: `dst[from..(from + 3)].copy_from_slice(&src[..(from + 3 - from)]);`
101101

102102
error: it looks like you're manually copying between slices
103-
--> $DIR/without_loop_counters.rs:115:5
103+
--> $DIR/without_loop_counters.rs:117:5
104104
|
105105
LL | / for i in 0..5 {
106106
LL | |
@@ -109,7 +109,7 @@ LL | | }
109109
| |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src);`
110110

111111
error: it looks like you're manually copying between slices
112-
--> $DIR/without_loop_counters.rs:121:5
112+
--> $DIR/without_loop_counters.rs:123:5
113113
|
114114
LL | / for i in 0..0 {
115115
LL | |
@@ -118,7 +118,7 @@ LL | | }
118118
| |_____^ help: try replacing the loop by: `dst[..0].copy_from_slice(&src[..0]);`
119119

120120
error: it looks like you're manually copying between slices
121-
--> $DIR/without_loop_counters.rs:145:5
121+
--> $DIR/without_loop_counters.rs:147:5
122122
|
123123
LL | / for i in 0..4 {
124124
LL | |
@@ -127,7 +127,7 @@ LL | | }
127127
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..4]);`
128128

129129
error: it looks like you're manually copying between slices
130-
--> $DIR/without_loop_counters.rs:151:5
130+
--> $DIR/without_loop_counters.rs:153:5
131131
|
132132
LL | / for i in 0..5 {
133133
LL | |
@@ -136,7 +136,7 @@ LL | | }
136136
| |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src);`
137137

138138
error: it looks like you're manually copying between slices
139-
--> $DIR/without_loop_counters.rs:157:5
139+
--> $DIR/without_loop_counters.rs:159:5
140140
|
141141
LL | / for i in 0..5 {
142142
LL | |
@@ -145,7 +145,7 @@ LL | | }
145145
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src);`
146146

147147
error: it looks like you're manually copying between slices
148-
--> $DIR/without_loop_counters.rs:165:5
148+
--> $DIR/without_loop_counters.rs:167:5
149149
|
150150
LL | / for i in 0..src.len() {
151151
LL | |

tests/ui/non_canonical_clone_impl.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(clippy::clone_on_copy, unused)]
2+
#![allow(clippy::assigning_clones)]
23
#![no_main]
34

45
// lint

tests/ui/non_canonical_clone_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(clippy::clone_on_copy, unused)]
2+
#![allow(clippy::assigning_clones)]
23
#![no_main]
34

45
// lint

tests/ui/non_canonical_clone_impl.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: non-canonical implementation of `clone` on a `Copy` type
2-
--> $DIR/non_canonical_clone_impl.rs:9:29
2+
--> $DIR/non_canonical_clone_impl.rs:10:29
33
|
44
LL | fn clone(&self) -> Self {
55
| _____________________________^
@@ -11,7 +11,7 @@ LL | | }
1111
= help: to override `-D warnings` add `#[allow(clippy::non_canonical_clone_impl)]`
1212

1313
error: unnecessary implementation of `clone_from` on a `Copy` type
14-
--> $DIR/non_canonical_clone_impl.rs:13:5
14+
--> $DIR/non_canonical_clone_impl.rs:14:5
1515
|
1616
LL | / fn clone_from(&mut self, source: &Self) {
1717
LL | | source.clone();
@@ -20,7 +20,7 @@ LL | | }
2020
| |_____^ help: remove it
2121

2222
error: non-canonical implementation of `clone` on a `Copy` type
23-
--> $DIR/non_canonical_clone_impl.rs:80:29
23+
--> $DIR/non_canonical_clone_impl.rs:81:29
2424
|
2525
LL | fn clone(&self) -> Self {
2626
| _____________________________^
@@ -29,7 +29,7 @@ LL | | }
2929
| |_____^ help: change this to: `{ *self }`
3030

3131
error: unnecessary implementation of `clone_from` on a `Copy` type
32-
--> $DIR/non_canonical_clone_impl.rs:84:5
32+
--> $DIR/non_canonical_clone_impl.rs:85:5
3333
|
3434
LL | / fn clone_from(&mut self, source: &Self) {
3535
LL | | source.clone();

0 commit comments

Comments
 (0)