@@ -151,13 +151,13 @@ impl L2capChannelReader {
151
151
. stream
152
152
. recv ( )
153
153
. await
154
- . map_err ( |_| Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" . to_string ( ) ) ) ?;
154
+ . map_err ( |_| Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" ) ) ?;
155
155
156
156
if packet. len ( ) > buf. len ( ) {
157
157
return Err ( Error :: new (
158
158
ErrorKind :: InvalidParameter ,
159
159
None ,
160
- "Buffer is too small" . to_string ( ) ,
160
+ "Buffer is too small" ,
161
161
) ) ;
162
162
}
163
163
@@ -169,15 +169,15 @@ impl L2capChannelReader {
169
169
#[ inline]
170
170
pub fn try_read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize > {
171
171
let packet = self . stream . try_recv ( ) . map_err ( |e| match e {
172
- TryRecvError :: Empty => Error :: new ( ErrorKind :: NotReady , None , "no received packet in queue" . to_string ( ) ) ,
173
- TryRecvError :: Closed => Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" . to_string ( ) ) ,
172
+ TryRecvError :: Empty => Error :: new ( ErrorKind :: NotReady , None , "no received packet in queue" ) ,
173
+ TryRecvError :: Closed => Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" ) ,
174
174
} ) ?;
175
175
176
176
if packet. len ( ) > buf. len ( ) {
177
177
return Err ( Error :: new (
178
178
ErrorKind :: InvalidParameter ,
179
179
None ,
180
- "Buffer is too small" . to_string ( ) ,
180
+ "Buffer is too small" ,
181
181
) ) ;
182
182
}
183
183
@@ -208,13 +208,13 @@ impl L2capChannelWriter {
208
208
self . stream
209
209
. send ( packet. to_vec ( ) )
210
210
. await
211
- . map_err ( |_| Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" . to_string ( ) ) )
211
+ . map_err ( |_| Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" ) )
212
212
}
213
213
214
214
pub fn try_write ( & mut self , packet : & [ u8 ] ) -> Result < ( ) > {
215
215
self . stream . try_send ( packet. to_vec ( ) ) . map_err ( |e| match e {
216
- TrySendError :: Closed ( _) => Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" . to_string ( ) ) ,
217
- TrySendError :: Full ( _) => Error :: new ( ErrorKind :: NotReady , None , "No buffer space for write" . to_string ( ) ) ,
216
+ TrySendError :: Closed ( _) => Error :: new ( ErrorKind :: ConnectionFailed , None , "channel is closed" ) ,
217
+ TrySendError :: Full ( _) => Error :: new ( ErrorKind :: NotReady , None , "No buffer space for write" ) ,
218
218
} )
219
219
}
220
220
0 commit comments