about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/swap_with_temporary.stderr
blob: 5ca4fccd37a2e3ab27dc840dbc0207bc0da1e329 (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
127
128
129
130
131
132
133
134
135
136
error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:22:5
   |
LL |     swap(&mut func(), &mut y);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `y = func()`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:22:15
   |
LL |     swap(&mut func(), &mut y);
   |               ^^^^^^
   = note: `-D clippy::swap-with-temporary` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::swap_with_temporary)]`

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:25:5
   |
LL |     swap(&mut x, &mut func());
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `x = func()`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:25:23
   |
LL |     swap(&mut x, &mut func());
   |                       ^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:28:5
   |
LL |     swap(z, &mut func());
   |     ^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*z = func()`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:28:18
   |
LL |     swap(z, &mut func());
   |                  ^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:36:5
   |
LL |     swap(&mut func(), z);
   |     ^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*z = func()`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:36:15
   |
LL |     swap(&mut func(), z);
   |               ^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:53:5
   |
LL |     swap(&mut mac!(funcall func), z);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*z = mac!(funcall func)`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:53:15
   |
LL |     swap(&mut mac!(funcall func), z);
   |               ^^^^^^^^^^^^^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:55:5
   |
LL |     swap(&mut mac!(funcall func), mac!(ident z));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*mac!(ident z) = mac!(funcall func)`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:55:15
   |
LL |     swap(&mut mac!(funcall func), mac!(ident z));
   |               ^^^^^^^^^^^^^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:57:5
   |
LL |     swap(mac!(ident z), &mut mac!(funcall func));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*mac!(ident z) = mac!(funcall func)`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:57:30
   |
LL |     swap(mac!(ident z), &mut mac!(funcall func));
   |                              ^^^^^^^^^^^^^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:59:5
   |
LL |     swap(mac!(refmut y), &mut func());
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*mac!(refmut y) = func()`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:59:31
   |
LL |     swap(mac!(refmut y), &mut func());
   |                               ^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:92:13
   |
LL |             swap(&mut vec![42], &mut self.thing.lock().unwrap());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `*self.thing.lock().unwrap() = vec![42]`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:92:23
   |
LL |             swap(&mut vec![42], &mut self.thing.lock().unwrap());
   |                       ^^^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:100:5
   |
LL |     swap(&mut ***v1, &mut vec![]);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `***v1 = vec![]`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:100:27
   |
LL |     swap(&mut ***v1, &mut vec![]);
   |                           ^^^^^^

error: swapping with a temporary value is inefficient
  --> tests/ui/swap_with_temporary.rs:118:5
   |
LL |     swap(&mut vec![], &mut v1.lock().unwrap());
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use assignment instead: `***v1.lock().unwrap() = vec![]`
   |
note: this expression returns a temporary value
  --> tests/ui/swap_with_temporary.rs:118:15
   |
LL |     swap(&mut vec![], &mut v1.lock().unwrap());
   |               ^^^^^^

error: aborting due to 11 previous errors