@@ -173,21 +173,21 @@ impl SocketRef {
173173 Socket :: new ( family, kind) . into_ref_with_type ( vm, cls)
174174 }
175175
176- fn connect ( self , address : PyTupleRef , vm : & VirtualMachine ) -> PyResult {
176+ fn connect ( self , address : PyTupleRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
177177 let address_string = get_address_string ( vm, address) ?;
178178
179179 match self . socket_kind {
180180 SocketKind :: Stream => match TcpStream :: connect ( address_string) {
181181 Ok ( stream) => {
182182 self . con . borrow_mut ( ) . replace ( Connection :: TcpStream ( stream) ) ;
183- Ok ( vm . get_none ( ) )
183+ Ok ( ( ) )
184184 }
185185 Err ( s) => Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
186186 } ,
187187 SocketKind :: Dgram => {
188188 if let Some ( Connection :: UdpSocket ( con) ) = self . con . borrow ( ) . as_ref ( ) {
189189 match con. connect ( address_string) {
190- Ok ( _) => Ok ( vm . get_none ( ) ) ,
190+ Ok ( _) => Ok ( ( ) ) ,
191191 Err ( s) => Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
192192 }
193193 } else {
@@ -197,7 +197,7 @@ impl SocketRef {
197197 }
198198 }
199199
200- fn bind ( self , address : PyTupleRef , vm : & VirtualMachine ) -> PyResult {
200+ fn bind ( self , address : PyTupleRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
201201 let address_string = get_address_string ( vm, address) ?;
202202
203203 match self . socket_kind {
@@ -206,14 +206,14 @@ impl SocketRef {
206206 self . con
207207 . borrow_mut ( )
208208 . replace ( Connection :: TcpListener ( stream) ) ;
209- Ok ( vm . get_none ( ) )
209+ Ok ( ( ) )
210210 }
211211 Err ( s) => Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
212212 } ,
213213 SocketKind :: Dgram => match UdpSocket :: bind ( address_string) {
214214 Ok ( dgram) => {
215215 self . con . borrow_mut ( ) . replace ( Connection :: UdpSocket ( dgram) ) ;
216- Ok ( vm . get_none ( ) )
216+ Ok ( ( ) )
217217 }
218218 Err ( s) => Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
219219 } ,
@@ -274,25 +274,25 @@ impl SocketRef {
274274 Ok ( vm. ctx . new_tuple ( vec ! [ vm. ctx. new_bytes( buffer) , addr_tuple] ) )
275275 }
276276
277- fn send ( self , bytes : PyBytesRef , vm : & VirtualMachine ) -> PyResult {
277+ fn send ( self , bytes : PyBytesRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
278278 match self . con . borrow_mut ( ) . as_mut ( ) {
279279 Some ( v) => match v. write ( & bytes) {
280280 Ok ( _) => ( ) ,
281281 Err ( s) => return Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
282282 } ,
283283 None => return Err ( vm. new_type_error ( "" . to_string ( ) ) ) ,
284284 } ;
285- Ok ( vm . get_none ( ) )
285+ Ok ( ( ) )
286286 }
287287
288- fn sendto ( self , bytes : PyBytesRef , address : PyTupleRef , vm : & VirtualMachine ) -> PyResult {
288+ fn sendto ( self , bytes : PyBytesRef , address : PyTupleRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
289289 let address_string = get_address_string ( vm, address) ?;
290290
291291 match self . socket_kind {
292292 SocketKind :: Dgram => {
293293 if let Some ( v) = self . con . borrow ( ) . as_ref ( ) {
294294 return match v. send_to ( & bytes, address_string) {
295- Ok ( _) => Ok ( vm . get_none ( ) ) ,
295+ Ok ( _) => Ok ( ( ) ) ,
296296 Err ( s) => Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
297297 } ;
298298 }
@@ -301,7 +301,7 @@ impl SocketRef {
301301 Ok ( dgram) => match dgram. send_to ( & bytes, address_string) {
302302 Ok ( _) => {
303303 self . con . borrow_mut ( ) . replace ( Connection :: UdpSocket ( dgram) ) ;
304- Ok ( vm . get_none ( ) )
304+ Ok ( ( ) )
305305 }
306306 Err ( s) => Err ( vm. new_os_error ( s. to_string ( ) ) ) ,
307307 } ,
@@ -312,9 +312,8 @@ impl SocketRef {
312312 }
313313 }
314314
315- fn close ( self , vm : & VirtualMachine ) -> PyResult {
315+ fn close ( self , _vm : & VirtualMachine ) -> ( ) {
316316 self . con . borrow_mut ( ) . take ( ) ;
317- Ok ( vm. get_none ( ) )
318317 }
319318
320319 fn fileno ( self , vm : & VirtualMachine ) -> PyResult {
0 commit comments