Skip to content

Commit 4d542ee

Browse files
committed
Attributes cleanup in tests [12/20]
1 parent fdd9f4e commit 4d542ee

85 files changed

Lines changed: 323 additions & 426 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/ui/mem_replace.fixed

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#![allow(unused, clippy::needless_lifetimes)]
21
#![warn(
3-
clippy::style,
42
clippy::mem_replace_option_with_none,
5-
clippy::mem_replace_with_default
3+
clippy::mem_replace_with_default,
4+
clippy::style
65
)]
76

87
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

tests/ui/mem_replace.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#![allow(unused, clippy::needless_lifetimes)]
21
#![warn(
3-
clippy::style,
42
clippy::mem_replace_option_with_none,
5-
clippy::mem_replace_with_default
3+
clippy::mem_replace_with_default,
4+
clippy::style
65
)]
76

87
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

tests/ui/mem_replace.stderr

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: replacing an `Option` with `None`
2-
--> tests/ui/mem_replace.rs:13:13
2+
--> tests/ui/mem_replace.rs:12:13
33
|
44
LL | let _ = mem::replace(&mut an_option, None);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
@@ -8,13 +8,13 @@ LL | let _ = mem::replace(&mut an_option, None);
88
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_option_with_none)]`
99

1010
error: replacing an `Option` with `None`
11-
--> tests/ui/mem_replace.rs:16:13
11+
--> tests/ui/mem_replace.rs:15:13
1212
|
1313
LL | let _ = mem::replace(an_option, None);
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
1515

1616
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
17-
--> tests/ui/mem_replace.rs:22:13
17+
--> tests/ui/mem_replace.rs:21:13
1818
|
1919
LL | let _ = std::mem::replace(&mut s, String::default());
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
@@ -23,145 +23,145 @@ LL | let _ = std::mem::replace(&mut s, String::default());
2323
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]`
2424

2525
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
26-
--> tests/ui/mem_replace.rs:24:13
26+
--> tests/ui/mem_replace.rs:23:13
2727
|
2828
LL | let _ = std::mem::replace(&mut s, String::new());
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
3030

3131
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
32-
--> tests/ui/mem_replace.rs:28:13
32+
--> tests/ui/mem_replace.rs:27:13
3333
|
3434
LL | let _ = std::mem::replace(s, String::default());
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
3636

3737
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
38-
--> tests/ui/mem_replace.rs:30:13
38+
--> tests/ui/mem_replace.rs:29:13
3939
|
4040
LL | let _ = std::mem::replace(s, String::new());
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
4242

4343
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
44-
--> tests/ui/mem_replace.rs:32:13
44+
--> tests/ui/mem_replace.rs:31:13
4545
|
4646
LL | let _ = std::mem::replace(s, Default::default());
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
4848

4949
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
50-
--> tests/ui/mem_replace.rs:36:13
50+
--> tests/ui/mem_replace.rs:35:13
5151
|
5252
LL | let _ = std::mem::replace(&mut v, Vec::default());
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
5454

5555
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
56-
--> tests/ui/mem_replace.rs:38:13
56+
--> tests/ui/mem_replace.rs:37:13
5757
|
5858
LL | let _ = std::mem::replace(&mut v, Default::default());
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
6060

6161
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
62-
--> tests/ui/mem_replace.rs:40:13
62+
--> tests/ui/mem_replace.rs:39:13
6363
|
6464
LL | let _ = std::mem::replace(&mut v, Vec::new());
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
6666

6767
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
68-
--> tests/ui/mem_replace.rs:42:13
68+
--> tests/ui/mem_replace.rs:41:13
6969
|
7070
LL | let _ = std::mem::replace(&mut v, vec![]);
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
7272

7373
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
74-
--> tests/ui/mem_replace.rs:46:13
74+
--> tests/ui/mem_replace.rs:45:13
7575
|
7676
LL | let _ = std::mem::replace(&mut hash_map, HashMap::new());
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_map)`
7878

7979
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
80-
--> tests/ui/mem_replace.rs:50:13
80+
--> tests/ui/mem_replace.rs:49:13
8181
|
8282
LL | let _ = std::mem::replace(&mut btree_map, BTreeMap::new());
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_map)`
8484

8585
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
86-
--> tests/ui/mem_replace.rs:54:13
86+
--> tests/ui/mem_replace.rs:53:13
8787
|
8888
LL | let _ = std::mem::replace(&mut vd, VecDeque::new());
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut vd)`
9090

9191
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
92-
--> tests/ui/mem_replace.rs:58:13
92+
--> tests/ui/mem_replace.rs:57:13
9393
|
9494
LL | let _ = std::mem::replace(&mut hash_set, HashSet::new());
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_set)`
9696

9797
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
98-
--> tests/ui/mem_replace.rs:62:13
98+
--> tests/ui/mem_replace.rs:61:13
9999
|
100100
LL | let _ = std::mem::replace(&mut btree_set, BTreeSet::new());
101101
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_set)`
102102

103103
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
104-
--> tests/ui/mem_replace.rs:66:13
104+
--> tests/ui/mem_replace.rs:65:13
105105
|
106106
LL | let _ = std::mem::replace(&mut list, LinkedList::new());
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut list)`
108108

109109
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
110-
--> tests/ui/mem_replace.rs:70:13
110+
--> tests/ui/mem_replace.rs:69:13
111111
|
112112
LL | let _ = std::mem::replace(&mut binary_heap, BinaryHeap::new());
113113
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut binary_heap)`
114114

115115
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
116-
--> tests/ui/mem_replace.rs:74:13
116+
--> tests/ui/mem_replace.rs:73:13
117117
|
118118
LL | let _ = std::mem::replace(&mut tuple, (vec![], BinaryHeap::new()));
119119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut tuple)`
120120

121121
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
122-
--> tests/ui/mem_replace.rs:78:13
122+
--> tests/ui/mem_replace.rs:77:13
123123
|
124124
LL | let _ = std::mem::replace(&mut refstr, "");
125125
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut refstr)`
126126

127127
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
128-
--> tests/ui/mem_replace.rs:82:13
128+
--> tests/ui/mem_replace.rs:81:13
129129
|
130130
LL | let _ = std::mem::replace(&mut slice, &[]);
131131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut slice)`
132132

133133
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
134-
--> tests/ui/mem_replace.rs:115:13
134+
--> tests/ui/mem_replace.rs:114:13
135135
|
136136
LL | let _ = std::mem::replace(&mut s, String::default());
137137
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
138138

139139
error: replacing an `Option` with `None`
140-
--> tests/ui/mem_replace.rs:146:13
140+
--> tests/ui/mem_replace.rs:145:13
141141
|
142142
LL | let _ = std::mem::replace(&mut f.0, None);
143143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `f.0.take()`
144144

145145
error: replacing an `Option` with `None`
146-
--> tests/ui/mem_replace.rs:148:13
146+
--> tests/ui/mem_replace.rs:147:13
147147
|
148148
LL | let _ = std::mem::replace(&mut *f, None);
149149
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `(*f).take()`
150150

151151
error: replacing an `Option` with `None`
152-
--> tests/ui/mem_replace.rs:150:13
152+
--> tests/ui/mem_replace.rs:149:13
153153
|
154154
LL | let _ = std::mem::replace(&mut b.opt, None);
155155
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `b.opt.take()`
156156

157157
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
158-
--> tests/ui/mem_replace.rs:153:13
158+
--> tests/ui/mem_replace.rs:152:13
159159
|
160160
LL | let _ = std::mem::replace(&mut b.val, String::default());
161161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut b.val)`
162162

163163
error: replacing an `Option` with `Some(..)`
164-
--> tests/ui/mem_replace.rs:160:20
164+
--> tests/ui/mem_replace.rs:159:20
165165
|
166166
LL | let replaced = mem::replace(&mut an_option, Some(1));
167167
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::replace()` instead: `an_option.replace(1)`
@@ -170,19 +170,19 @@ LL | let replaced = mem::replace(&mut an_option, Some(1));
170170
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_option_with_some)]`
171171

172172
error: replacing an `Option` with `Some(..)`
173-
--> tests/ui/mem_replace.rs:164:20
173+
--> tests/ui/mem_replace.rs:163:20
174174
|
175175
LL | let replaced = mem::replace(an_option, Some(1));
176176
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::replace()` instead: `an_option.replace(1)`
177177

178178
error: replacing an `Option` with `Some(..)`
179-
--> tests/ui/mem_replace.rs:169:20
179+
--> tests/ui/mem_replace.rs:168:20
180180
|
181181
LL | let replaced = mem::replace(if b { &mut opt1 } else { &mut opt2 }, Some(1));
182182
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::replace()` instead: `(if b { &mut opt1 } else { &mut opt2 }).replace(1)`
183183

184184
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
185-
--> tests/ui/mem_replace.rs:181:20
185+
--> tests/ui/mem_replace.rs:180:20
186186
|
187187
LL | let replaced = std::mem::replace(dbg!(&mut text), String::default());
188188
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(dbg!(&mut text))`

tests/ui/mem_replace_no_std.fixed

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#![allow(unused, clippy::needless_lifetimes)]
21
#![warn(
3-
clippy::style,
42
clippy::mem_replace_option_with_none,
5-
clippy::mem_replace_with_default
3+
clippy::mem_replace_with_default,
4+
clippy::style
65
)]
76
#![feature(lang_items)]
87
#![no_std]

tests/ui/mem_replace_no_std.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#![allow(unused, clippy::needless_lifetimes)]
21
#![warn(
3-
clippy::style,
42
clippy::mem_replace_option_with_none,
5-
clippy::mem_replace_with_default
3+
clippy::mem_replace_with_default,
4+
clippy::style
65
)]
76
#![feature(lang_items)]
87
#![no_std]

tests/ui/mem_replace_no_std.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: replacing an `Option` with `None`
2-
--> tests/ui/mem_replace_no_std.rs:23:13
2+
--> tests/ui/mem_replace_no_std.rs:22:13
33
|
44
LL | let _ = mem::replace(&mut an_option, None);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
@@ -8,13 +8,13 @@ LL | let _ = mem::replace(&mut an_option, None);
88
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_option_with_none)]`
99

1010
error: replacing an `Option` with `None`
11-
--> tests/ui/mem_replace_no_std.rs:26:13
11+
--> tests/ui/mem_replace_no_std.rs:25:13
1212
|
1313
LL | let _ = mem::replace(an_option, None);
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
1515

1616
error: replacing a value of type `T` with `T::default()` is better expressed using `core::mem::take`
17-
--> tests/ui/mem_replace_no_std.rs:32:13
17+
--> tests/ui/mem_replace_no_std.rs:31:13
1818
|
1919
LL | let _ = mem::replace(&mut refstr, "");
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::mem::take(&mut refstr)`
@@ -23,25 +23,25 @@ LL | let _ = mem::replace(&mut refstr, "");
2323
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]`
2424

2525
error: replacing a value of type `T` with `T::default()` is better expressed using `core::mem::take`
26-
--> tests/ui/mem_replace_no_std.rs:36:13
26+
--> tests/ui/mem_replace_no_std.rs:35:13
2727
|
2828
LL | let _ = mem::replace(&mut slice, &[]);
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::mem::take(&mut slice)`
3030

3131
error: replacing an `Option` with `None`
32-
--> tests/ui/mem_replace_no_std.rs:76:13
32+
--> tests/ui/mem_replace_no_std.rs:75:13
3333
|
3434
LL | let _ = mem::replace(&mut f.0, None);
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `f.0.take()`
3636

3737
error: replacing an `Option` with `None`
38-
--> tests/ui/mem_replace_no_std.rs:78:13
38+
--> tests/ui/mem_replace_no_std.rs:77:13
3939
|
4040
LL | let _ = mem::replace(&mut *f, None);
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `(*f).take()`
4242

4343
error: replacing an `Option` with `None`
44-
--> tests/ui/mem_replace_no_std.rs:80:13
44+
--> tests/ui/mem_replace_no_std.rs:79:13
4545
|
4646
LL | let _ = mem::replace(&mut b.opt, None);
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `b.opt.take()`

tests/ui/methods.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
//@aux-build:option_helpers.rs
22

3-
#![allow(
4-
clippy::disallowed_names,
5-
clippy::default_trait_access,
6-
clippy::let_underscore_untyped,
7-
clippy::missing_docs_in_private_items,
8-
clippy::missing_safety_doc,
9-
clippy::non_ascii_literal,
10-
clippy::new_without_default,
11-
clippy::needless_pass_by_value,
12-
clippy::needless_lifetimes,
13-
clippy::elidable_lifetime_names,
14-
clippy::print_stdout,
15-
clippy::must_use_candidate,
16-
clippy::use_self,
17-
clippy::useless_format,
18-
clippy::wrong_self_convention,
19-
clippy::unused_async,
20-
clippy::unused_self,
21-
clippy::useless_vec
22-
)]
3+
#![warn(clippy::filter_next, clippy::new_ret_no_self)]
4+
#![expect(clippy::disallowed_names, clippy::useless_vec)]
235

246
#[macro_use]
257
extern crate option_helpers;

tests/ui/methods.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: methods called `new` usually return `Self`
2-
--> tests/ui/methods.rs:102:5
2+
--> tests/ui/methods.rs:84:5
33
|
44
LL | / fn new() -> i32 {
55
LL | |
@@ -11,7 +11,7 @@ LL | | }
1111
= help: to override `-D warnings` add `#[allow(clippy::new_ret_no_self)]`
1212

1313
error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
14-
--> tests/ui/methods.rs:124:13
14+
--> tests/ui/methods.rs:106:13
1515
|
1616
LL | let _ = v.iter().filter(|&x| {
1717
| _____________^
@@ -25,7 +25,7 @@ LL | | ).next();
2525
= help: to override `-D warnings` add `#[allow(clippy::filter_next)]`
2626

2727
error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead
28-
--> tests/ui/methods.rs:143:13
28+
--> tests/ui/methods.rs:125:13
2929
|
3030
LL | let _ = v.iter().filter(|&x| {
3131
| _____________^

tests/ui/methods_fixable.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::filter_next)]
2-
#![allow(clippy::useless_vec)]
2+
#![expect(clippy::useless_vec)]
33

44
/// Checks implementation of `FILTER_NEXT` lint.
55
fn main() {

tests/ui/methods_fixable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::filter_next)]
2-
#![allow(clippy::useless_vec)]
2+
#![expect(clippy::useless_vec)]
33

44
/// Checks implementation of `FILTER_NEXT` lint.
55
fn main() {

0 commit comments

Comments
 (0)