@@ -137,7 +137,7 @@ impl FileDescription for AnonSocket {
137
137
// Always succeed on read size 0.
138
138
if request_byte_size == 0 {
139
139
let result = Ok ( 0 ) ;
140
- return ecx. return_read_bytes_and_count ( ptr, bytes. to_vec ( ) , result, dest) ;
140
+ return ecx. return_read_bytes_and_count ( ptr, & bytes, result, dest) ;
141
141
}
142
142
143
143
let Some ( readbuf) = & self . readbuf else {
@@ -151,7 +151,7 @@ impl FileDescription for AnonSocket {
151
151
// Socketpair with no peer and empty buffer.
152
152
// 0 bytes successfully read indicates end-of-file.
153
153
let result = Ok ( 0 ) ;
154
- return ecx. return_read_bytes_and_count ( ptr, bytes. to_vec ( ) , result, dest) ;
154
+ return ecx. return_read_bytes_and_count ( ptr, & bytes, result, dest) ;
155
155
} else {
156
156
if self . is_nonblock {
157
157
// Non-blocking socketpair with writer and empty buffer.
@@ -160,7 +160,7 @@ impl FileDescription for AnonSocket {
160
160
// POSIX.1-2001 allows either error to be returned for this case.
161
161
// Since there is no ErrorKind for EAGAIN, WouldBlock is used.
162
162
let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
163
- return ecx. return_read_bytes_and_count ( ptr, bytes. to_vec ( ) , result, dest) ;
163
+ return ecx. return_read_bytes_and_count ( ptr, & bytes, result, dest) ;
164
164
} else {
165
165
// Blocking socketpair with writer and empty buffer.
166
166
// FIXME: blocking is currently not supported
@@ -193,7 +193,7 @@ impl FileDescription for AnonSocket {
193
193
}
194
194
195
195
let result = Ok ( actual_read_size) ;
196
- ecx. return_read_bytes_and_count ( ptr, bytes. to_vec ( ) , result, dest)
196
+ ecx. return_read_bytes_and_count ( ptr, & bytes, result, dest)
197
197
}
198
198
199
199
fn write < ' tcx > (
0 commit comments