summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/mem_replace.stderr
blob: dd8a50dab9002f1649d970a1af348d99993bbb0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
error: replacing an `Option` with `None`
  --> $DIR/mem_replace.rs:17:13
   |
LL |     let _ = mem::replace(&mut an_option, None);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
   |
   = note: `-D clippy::mem-replace-option-with-none` implied by `-D warnings`

error: replacing an `Option` with `None`
  --> $DIR/mem_replace.rs:19:13
   |
LL |     let _ = mem::replace(an_option, None);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`

error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
  --> $DIR/mem_replace.rs:24:13
   |
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`

error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
  --> $DIR/mem_replace.rs:27:13
   |
LL |     let _ = std::mem::replace(s, String::default());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`

error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
  --> $DIR/mem_replace.rs:28:13
   |
LL |     let _ = std::mem::replace(s, Default::default());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`

error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
  --> $DIR/mem_replace.rs:31:13
   |
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`
  --> $DIR/mem_replace.rs:32:13
   |
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`
  --> $DIR/mem_replace.rs:33:13
   |
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`
  --> $DIR/mem_replace.rs:34:13
   |
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`
  --> $DIR/mem_replace.rs:37:13
   |
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`
  --> $DIR/mem_replace.rs:40:13
   |
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`
  --> $DIR/mem_replace.rs:43:13
   |
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`
  --> $DIR/mem_replace.rs:46:13
   |
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`
  --> $DIR/mem_replace.rs:49:13
   |
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`
  --> $DIR/mem_replace.rs:52:13
   |
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`
  --> $DIR/mem_replace.rs:55:13
   |
LL |     let _ = std::mem::replace(&mut binary_heap, BinaryHeap::new());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut binary_heap)`

error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
  --> $DIR/mem_replace.rs:58:13
   |
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`
  --> $DIR/mem_replace.rs:61:13
   |
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`
  --> $DIR/mem_replace.rs:64:13
   |
LL |     let _ = std::mem::replace(&mut slice, &[]);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut slice)`

error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
  --> $DIR/mem_replace.rs:94:13
   |
LL |     let _ = std::mem::replace(&mut s, String::default());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`

error: aborting due to 20 previous errors