11error: replacing an `Option` with `None`
2- --> tests/ui/mem_replace.rs:13 :13
2+ --> tests/ui/mem_replace.rs:12 :13
33 |
44LL | 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
1010error: replacing an `Option` with `None`
11- --> tests/ui/mem_replace.rs:16 :13
11+ --> tests/ui/mem_replace.rs:15 :13
1212 |
1313LL | let _ = mem::replace(an_option, None);
1414 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
1515
1616error: 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 |
1919LL | 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
2525error: 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 |
2828LL | let _ = std::mem::replace(&mut s, String::new());
2929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
3030
3131error: 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 |
3434LL | let _ = std::mem::replace(s, String::default());
3535 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
3636
3737error: 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 |
4040LL | let _ = std::mem::replace(s, String::new());
4141 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
4242
4343error: 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 |
4646LL | let _ = std::mem::replace(s, Default::default());
4747 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
4848
4949error: 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 |
5252LL | let _ = std::mem::replace(&mut v, Vec::default());
5353 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
5454
5555error: 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 |
5858LL | let _ = std::mem::replace(&mut v, Default::default());
5959 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
6060
6161error: 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 |
6464LL | let _ = std::mem::replace(&mut v, Vec::new());
6565 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
6666
6767error: 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 |
7070LL | let _ = std::mem::replace(&mut v, vec![]);
7171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
7272
7373error: 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 |
7676LL | let _ = std::mem::replace(&mut hash_map, HashMap::new());
7777 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_map)`
7878
7979error: 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 |
8282LL | let _ = std::mem::replace(&mut btree_map, BTreeMap::new());
8383 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_map)`
8484
8585error: 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 |
8888LL | let _ = std::mem::replace(&mut vd, VecDeque::new());
8989 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut vd)`
9090
9191error: 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 |
9494LL | let _ = std::mem::replace(&mut hash_set, HashSet::new());
9595 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_set)`
9696
9797error: 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 |
100100LL | let _ = std::mem::replace(&mut btree_set, BTreeSet::new());
101101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_set)`
102102
103103error: 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 |
106106LL | let _ = std::mem::replace(&mut list, LinkedList::new());
107107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut list)`
108108
109109error: 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 |
112112LL | let _ = std::mem::replace(&mut binary_heap, BinaryHeap::new());
113113 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut binary_heap)`
114114
115115error: 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 |
118118LL | let _ = std::mem::replace(&mut tuple, (vec![], BinaryHeap::new()));
119119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut tuple)`
120120
121121error: 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 |
124124LL | let _ = std::mem::replace(&mut refstr, "");
125125 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut refstr)`
126126
127127error: 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 |
130130LL | let _ = std::mem::replace(&mut slice, &[]);
131131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut slice)`
132132
133133error: 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 |
136136LL | let _ = std::mem::replace(&mut s, String::default());
137137 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
138138
139139error: replacing an `Option` with `None`
140- --> tests/ui/mem_replace.rs:146 :13
140+ --> tests/ui/mem_replace.rs:145 :13
141141 |
142142LL | let _ = std::mem::replace(&mut f.0, None);
143143 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `f.0.take()`
144144
145145error: replacing an `Option` with `None`
146- --> tests/ui/mem_replace.rs:148 :13
146+ --> tests/ui/mem_replace.rs:147 :13
147147 |
148148LL | let _ = std::mem::replace(&mut *f, None);
149149 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `(*f).take()`
150150
151151error: replacing an `Option` with `None`
152- --> tests/ui/mem_replace.rs:150 :13
152+ --> tests/ui/mem_replace.rs:149 :13
153153 |
154154LL | let _ = std::mem::replace(&mut b.opt, None);
155155 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `b.opt.take()`
156156
157157error: 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 |
160160LL | let _ = std::mem::replace(&mut b.val, String::default());
161161 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut b.val)`
162162
163163error: replacing an `Option` with `Some(..)`
164- --> tests/ui/mem_replace.rs:160 :20
164+ --> tests/ui/mem_replace.rs:159 :20
165165 |
166166LL | 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
172172error: replacing an `Option` with `Some(..)`
173- --> tests/ui/mem_replace.rs:164 :20
173+ --> tests/ui/mem_replace.rs:163 :20
174174 |
175175LL | let replaced = mem::replace(an_option, Some(1));
176176 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::replace()` instead: `an_option.replace(1)`
177177
178178error: replacing an `Option` with `Some(..)`
179- --> tests/ui/mem_replace.rs:169 :20
179+ --> tests/ui/mem_replace.rs:168 :20
180180 |
181181LL | 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
184184error: 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 |
187187LL | let replaced = std::mem::replace(dbg!(&mut text), String::default());
188188 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(dbg!(&mut text))`
0 commit comments