blob: 8690ba4a198a99f772fee68f74f9400f42d902de [file]
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:12:13
|
LL | let _ = std::mem::replace(&mut s, String::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut s)`
|
= note: `-D clippy::mem-replace-with-default` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:14:13
|
LL | let _ = std::mem::replace(&mut s, String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut s)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:18:13
|
LL | let _ = std::mem::replace(s, String::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(s)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:20:13
|
LL | let _ = std::mem::replace(s, String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(s)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:22:13
|
LL | let _ = std::mem::replace(s, Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(s)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:26:13
|
LL | let _ = std::mem::replace(&mut v, Vec::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut v)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:28:13
|
LL | let _ = std::mem::replace(&mut v, Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut v)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:30:13
|
LL | let _ = std::mem::replace(&mut v, Vec::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut v)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:32:13
|
LL | let _ = std::mem::replace(&mut v, vec![]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut v)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:36:13
|
LL | let _ = std::mem::replace(&mut hash_map, HashMap::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut hash_map)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:40:13
|
LL | let _ = std::mem::replace(&mut btree_map, BTreeMap::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut btree_map)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:44:13
|
LL | let _ = std::mem::replace(&mut vd, VecDeque::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut vd)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:48:13
|
LL | let _ = std::mem::replace(&mut hash_set, HashSet::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut hash_set)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:52:13
|
LL | let _ = std::mem::replace(&mut btree_set, BTreeSet::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut btree_set)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:56:13
|
LL | let _ = std::mem::replace(&mut list, LinkedList::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut list)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:60:13
|
LL | let _ = std::mem::replace(&mut binary_heap, BinaryHeap::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut binary_heap)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:64:13
|
LL | let _ = std::mem::replace(&mut tuple, (vec![], BinaryHeap::new()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut tuple)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:68:13
|
LL | let _ = std::mem::replace(&mut refstr, "");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut refstr)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:72:13
|
LL | let _ = std::mem::replace(&mut slice, &[]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut slice)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:78:21
|
LL | let _ = inline!(std::mem::replace($s, Default::default()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take($s)`
|
= note: this error originates in the macro `__inline_mac_fn_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:110:13
|
LL | let _ = std::mem::replace(&mut s, String::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut s)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:123:13
|
LL | let _ = std::mem::replace(&mut b.val, String::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(&mut b.val)`
error: replacing a value of type `T` with `T::default()`
--> tests/ui/mem_replace_with_default.rs:129:20
|
LL | let replaced = std::mem::replace(dbg!(&mut text), String::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `std::mem::take` instead: `std::mem::take(dbg!(&mut text))`
error: aborting due to 23 previous errors