Skip to content

Commit c3dad1d

Browse files
committed
fix lints
1 parent 6abf7f1 commit c3dad1d

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

stdlib/src/ssl.rs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ mod _ssl {
3939
socket::{self, PySocket},
4040
vm::{
4141
Py, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
42-
builtins::{PyBaseExceptionRef, PyBytesRef, PyListRef, PyStrRef, PyType, PyTypeRef, PyWeak},
42+
builtins::{
43+
PyBaseExceptionRef, PyBytesRef, PyListRef, PyStrRef, PyType, PyTypeRef, PyWeak,
44+
},
4345
class_or_notimplemented,
4446
convert::{ToPyException, ToPyObject},
4547
exceptions,
@@ -583,7 +585,7 @@ mod _ssl {
583585
#[pymethod]
584586
fn get_ciphers(&self, vm: &VirtualMachine) -> PyResult<PyListRef> {
585587
let ctx = self.ctx();
586-
let ssl = ssl::Ssl::new(&*ctx).map_err(|e| convert_openssl_error(vm, e))?;
588+
let ssl = ssl::Ssl::new(&ctx).map_err(|e| convert_openssl_error(vm, e))?;
587589

588590
unsafe {
589591
let ciphers_ptr = SSL_get_ciphers(ssl.as_ptr());
@@ -701,21 +703,17 @@ mod _ssl {
701703
let clear = flags & !new_flags;
702704
let set = !flags & new_flags;
703705

704-
if clear != 0 {
705-
if sys::X509_VERIFY_PARAM_clear_flags(param, clear) == 0 {
706-
return Err(vm.new_exception_msg(
707-
ssl_error(vm),
708-
"Failed to clear verify flags".to_owned(),
709-
));
710-
}
706+
if clear != 0 && sys::X509_VERIFY_PARAM_clear_flags(param, clear) == 0 {
707+
return Err(vm.new_exception_msg(
708+
ssl_error(vm),
709+
"Failed to clear verify flags".to_owned(),
710+
));
711711
}
712-
if set != 0 {
713-
if sys::X509_VERIFY_PARAM_set_flags(param, set) == 0 {
714-
return Err(vm.new_exception_msg(
715-
ssl_error(vm),
716-
"Failed to set verify flags".to_owned(),
717-
));
718-
}
712+
if set != 0 && sys::X509_VERIFY_PARAM_set_flags(param, set) == 0 {
713+
return Err(vm.new_exception_msg(
714+
ssl_error(vm),
715+
"Failed to set verify flags".to_owned(),
716+
));
719717
}
720718
Ok(())
721719
}
@@ -1356,10 +1354,7 @@ mod _ssl {
13561354

13571355
if ret < 0 {
13581356
// Error occurred
1359-
let err = unsafe {
1360-
let err_code = sys::SSL_get_error(ssl_ptr, ret);
1361-
err_code
1362-
};
1357+
let err = unsafe { sys::SSL_get_error(ssl_ptr, ret) };
13631358

13641359
if err == sys::SSL_ERROR_WANT_READ || err == sys::SSL_ERROR_WANT_WRITE {
13651360
// Non-blocking would block - this is okay for shutdown

0 commit comments

Comments
 (0)