2018-09-16 18:25:33 -05:00
|
|
|
error: replacing an `Option` with `None`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:13:13
|
2018-10-06 11:18:06 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let _ = mem::replace(&mut an_option, None);
|
2018-10-06 11:18:06 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::mem-replace-option-with-none` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_option_with_none)]`
|
2018-09-16 18:25:33 -05:00
|
|
|
|
2018-09-18 18:54:01 -05:00
|
|
|
error: replacing an `Option` with `None`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:15:13
|
2018-09-18 18:54:01 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let _ = mem::replace(an_option, None);
|
2018-09-18 18:54:01 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
|
|
|
|
|
2019-12-07 21:10:06 -06:00
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:20:13
|
2019-12-07 21:10:06 -06:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut s, String::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::mem-replace-with-default` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]`
|
2019-12-07 21:10:06 -06:00
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:23:13
|
2019-12-07 21:10:06 -06:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(s, String::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
|
|
|
|
|
2019-12-08 11:26:37 -06:00
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:24:13
|
2019-12-08 11:26:37 -06:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(s, Default::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
|
|
|
|
|
2021-03-25 13:29:11 -05:00
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:27:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut v, Vec::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:28:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut v, Default::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:29:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut v, Vec::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:30:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut v, vec![]);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut v)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:33:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut hash_map, HashMap::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_map)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:36:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut btree_map, BTreeMap::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_map)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:39:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut vd, VecDeque::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut vd)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:42:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut hash_set, HashSet::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut hash_set)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:45:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut btree_set, BTreeSet::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut btree_set)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:48:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut list, LinkedList::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut list)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:51:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut binary_heap, BinaryHeap::new());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut binary_heap)`
|
|
|
|
|
2021-09-08 09:31:47 -05:00
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:54:13
|
2021-09-08 09:31:47 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut tuple, (vec![], BinaryHeap::new()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut tuple)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:57:13
|
2021-09-08 09:31:47 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut refstr, "");
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut refstr)`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:60:13
|
2021-09-08 09:31:47 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut slice, &[]);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut slice)`
|
|
|
|
|
2022-10-23 08:18:45 -05:00
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:96:13
|
2022-10-23 08:18:45 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut s, String::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
|
|
|
|
|
2023-04-11 08:31:08 -05:00
|
|
|
error: replacing an `Option` with `None`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:126:13
|
2023-04-11 08:31:08 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut f.0, None);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `f.0.take()`
|
|
|
|
|
|
|
|
error: replacing an `Option` with `None`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:127:13
|
2023-04-11 08:31:08 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut *f, None);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `(*f).take()`
|
|
|
|
|
|
|
|
error: replacing an `Option` with `None`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:128:13
|
2023-04-11 08:31:08 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut b.opt, None);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `b.opt.take()`
|
|
|
|
|
|
|
|
error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
|
2024-08-18 06:31:47 -05:00
|
|
|
--> tests/ui/mem_replace.rs:130:13
|
2023-04-11 08:31:08 -05:00
|
|
|
|
|
|
|
|
LL | let _ = std::mem::replace(&mut b.val, String::default());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut b.val)`
|
|
|
|
|
|
|
|
error: aborting due to 24 previous errors
|
2018-09-16 18:25:33 -05:00
|
|
|
|