rust: bssl-tls: adopt Linux kernel Rust import style

Signed-off-by: Xiangfei Ding <xfding@google.com>
Change-Id: I662dc7db9fb1b7b24bc37ec40d0fb68a6a6a6964
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/92947
Reviewed-by: Rudolf Polzer <rpolzer@google.com>
diff --git a/rust/bssl-tls/src/connection.rs b/rust/bssl-tls/src/connection.rs
index 7944996..5e18860 100644
--- a/rust/bssl-tls/src/connection.rs
+++ b/rust/bssl-tls/src/connection.rs
@@ -19,17 +19,23 @@
     ffi::c_int,
     marker::PhantomData,
     mem::transmute,
-    ops::{Deref, DerefMut},
+    ops::{
+        Deref,
+        DerefMut, //
+    },
     ptr::NonNull,
-    task::Waker,
+    task::Waker, //
 };
 
 use crate::{
     config::ProtocolVersion,
     connection::methods::waker_data_ref_from_ssl,
     context::TlsMode,
-    errors::{Error, TlsRetryReason},
-    io::IoStatus,
+    errors::{
+        Error,
+        TlsRetryReason, //
+    },
+    io::IoStatus, //
 };
 
 mod credentials;
diff --git a/rust/bssl-tls/src/connection/credentials.rs b/rust/bssl-tls/src/connection/credentials.rs
index e7f0779..562406f 100644
--- a/rust/bssl-tls/src/connection/credentials.rs
+++ b/rust/bssl-tls/src/connection/credentials.rs
@@ -13,18 +13,30 @@
 // limitations under the License.
 
 use alloc::ffi::CString;
-use core::{ffi::CStr, ptr::null};
+use core::{
+    ffi::CStr,
+    ptr::null, //
+};
 
 use bssl_x509::store::X509Store;
 
-use super::{Client, methods::HasTlsConnectionMethod};
+use super::{
+    Client,
+    methods::HasTlsConnectionMethod, //
+};
 use crate::{
     check_lib_error,
     config::ConfigurationError,
-    connection::lifecycle::{EstablishedTlsConnection, TlsConnectionInHandshake},
-    credentials::{CertificateVerificationMode, TlsCredential},
+    connection::lifecycle::{
+        EstablishedTlsConnection,
+        TlsConnectionInHandshake, //
+    }, //
+    credentials::{
+        CertificateVerificationMode,
+        TlsCredential, //
+    },
     errors::Error,
-    ffi::slice_into_ffi_raw_parts,
+    ffi::slice_into_ffi_raw_parts, //
 };
 
 /// # Custom certificate verification
diff --git a/rust/bssl-tls/src/connection/lifecycle.rs b/rust/bssl-tls/src/connection/lifecycle.rs
index ff1261a..749e2ea 100644
--- a/rust/bssl-tls/src/connection/lifecycle.rs
+++ b/rust/bssl-tls/src/connection/lifecycle.rs
@@ -17,16 +17,31 @@
 use alloc::boxed::Box;
 use core::{
     future::poll_fn,
-    ops::{Deref, DerefMut},
-    task::Poll,
+    ops::{
+        Deref,
+        DerefMut, //
+    },
+    task::Poll, //
 };
 
 use crate::{
     check_tls_error,
-    connection::{Client, Server, TlsConnectionRef, methods::HasTlsConnectionMethod},
-    context::{SupportedMode, TlsMode},
-    errors::{Error, TlsErrorReason, TlsRetryReason},
-    io::IoStatus,
+    connection::{
+        Client,
+        Server,
+        TlsConnectionRef,
+        methods::HasTlsConnectionMethod, //
+    },
+    context::{
+        SupportedMode,
+        TlsMode, //
+    },
+    errors::{
+        Error,
+        TlsErrorReason,
+        TlsRetryReason, //
+    },
+    io::IoStatus, //
 };
 
 /// # Connection shutdown
diff --git a/rust/bssl-tls/src/connection/methods.rs b/rust/bssl-tls/src/connection/methods.rs
index 0970123..f4b04bd 100644
--- a/rust/bssl-tls/src/connection/methods.rs
+++ b/rust/bssl-tls/src/connection/methods.rs
@@ -14,20 +14,31 @@
 
 use alloc::boxed::Box;
 use core::{
-    ffi::{c_int, c_long, c_void},
-    ptr::{NonNull, null_mut},
-    task::Waker,
+    ffi::{
+        c_int,
+        c_long,
+        c_void, //
+    },
+    ptr::{
+        NonNull,
+        null_mut, //
+    },
+    task::Waker, //
 };
 use std::marker::PhantomData;
 
 use once_cell::sync::Lazy;
 
 use crate::{
-    Methods, abort_on_panic,
-    context::{QuicMode, TlsMode},
+    Methods,
+    abort_on_panic,
+    context::{
+        QuicMode,
+        TlsMode, //
+    },
     errors::TlsRetryReason,
     io::RustBioHandle,
-    methods::drop_box_rust_methods,
+    methods::drop_box_rust_methods, //
 };
 
 /// The associated state to the [`super::TlsConnection`].
diff --git a/rust/bssl-tls/src/connection/transport.rs b/rust/bssl-tls/src/connection/transport.rs
index 0c3a694..c84864b 100644
--- a/rust/bssl-tls/src/connection/transport.rs
+++ b/rust/bssl-tls/src/connection/transport.rs
@@ -19,7 +19,12 @@
     connection::TlsConnectionRef,
     context::TlsMode,
     errors::Error,
-    io::{AbstractReader, AbstractSocket, AbstractWriter, RustBio},
+    io::{
+        AbstractReader,
+        AbstractSocket,
+        AbstractWriter,
+        RustBio, //
+    }, //
 };
 
 /// # Transport configurations
diff --git a/rust/bssl-tls/src/context.rs b/rust/bssl-tls/src/context.rs
index d75694a..f3692d3 100644
--- a/rust/bssl-tls/src/context.rs
+++ b/rust/bssl-tls/src/context.rs
@@ -14,14 +14,26 @@
 
 //! TLS context builder and context type
 
-use alloc::{boxed::Box, sync::Arc};
-use core::{marker::PhantomData, mem::forget, ptr::NonNull};
+use alloc::{
+    boxed::Box,
+    sync::Arc, //
+};
+use core::{
+    marker::PhantomData,
+    mem::forget,
+    ptr::NonNull, //
+};
 
 use crate::{
     config::CompliancePolicy,
-    connection::{Client, Server, TlsConnection, methods::HasTlsConnectionMethod},
+    connection::{
+        Client,
+        Server,
+        TlsConnection,
+        methods::HasTlsConnectionMethod, //
+    },
     context::methods::HasTlsContextMethod,
-    errors::Error,
+    errors::Error, //
 };
 
 mod credentials;
@@ -223,7 +235,7 @@
     /// - `self` must outlive all uses of the returned handle;
     /// - this handle must be used with functions from the BoringSSL library this crate is linked
     ///   to; otherwise, it is **undefined behaviour**.
-    /// 
+    ///
     /// # Recommendation
     /// If the handle is used to interface BoringSSL library functions, please consider using a
     /// corresponding Rust safe binding or contact BoringSSL Authors for support.
diff --git a/rust/bssl-tls/src/context/credentials.rs b/rust/bssl-tls/src/context/credentials.rs
index bb9f304..d6b2f79 100644
--- a/rust/bssl-tls/src/context/credentials.rs
+++ b/rust/bssl-tls/src/context/credentials.rs
@@ -19,9 +19,15 @@
 use super::TlsContextBuilder;
 use crate::{
     check_lib_error,
-    context::{CertificateCache, SupportedMode},
-    credentials::{CertificateVerificationMode, TlsCredential},
-    errors::Error,
+    context::{
+        CertificateCache,
+        SupportedMode, //
+    },
+    credentials::{
+        CertificateVerificationMode,
+        TlsCredential, //
+    },
+    errors::Error, //
 };
 
 /// # Credentials
diff --git a/rust/bssl-tls/src/context/methods.rs b/rust/bssl-tls/src/context/methods.rs
index 947629c..3f40245 100644
--- a/rust/bssl-tls/src/context/methods.rs
+++ b/rust/bssl-tls/src/context/methods.rs
@@ -12,14 +12,21 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use core::{ffi::c_int, marker::PhantomData, ptr::null_mut};
+use core::{
+    ffi::c_int,
+    marker::PhantomData,
+    ptr::null_mut, //
+};
 
 use once_cell::sync::Lazy;
 
 use crate::{
     Methods,
-    context::{QuicMode, TlsMode},
-    methods::drop_box_rust_methods,
+    context::{
+        QuicMode,
+        TlsMode, //
+    },
+    methods::drop_box_rust_methods, //
 };
 
 pub(crate) struct RustContextMethods<M>(PhantomData<fn() -> M>);
diff --git a/rust/bssl-tls/src/credentials.rs b/rust/bssl-tls/src/credentials.rs
index 1fc3a90..3e3f1aa 100644
--- a/rust/bssl-tls/src/credentials.rs
+++ b/rust/bssl-tls/src/credentials.rs
@@ -14,24 +14,45 @@
 
 //! TLS credentials
 
-use alloc::{boxed::Box, vec, vec::Vec};
+use alloc::{
+    boxed::Box,
+    vec,
+    vec::Vec, //
+};
 use core::{
-    ffi::{CStr, c_int},
+    ffi::{
+        CStr,
+        c_int, //
+    },
     fmt::Debug,
     marker::PhantomData,
     mem::forget,
-    ptr::{NonNull, null_mut},
+    ptr::{
+        NonNull,
+        null_mut, //
+    }, //
 };
 
-use bssl_x509::{errors::PemReason, keys::PrivateKey};
+use bssl_x509::{
+    errors::PemReason,
+    keys::PrivateKey, //
+};
 
 use crate::{
     check_lib_error,
     config::ConfigurationError,
     context::CertificateCache,
     crypto_buffer_wrapper,
-    errors::{Error, IoError},
-    ffi::{Alloc, Bio, sanitize_slice, slice_into_ffi_raw_parts},
+    errors::{
+        Error,
+        IoError, //
+    },
+    ffi::{
+        Alloc,
+        Bio,
+        sanitize_slice,
+        slice_into_ffi_raw_parts, //
+    }, //
 };
 
 pub(crate) mod methods;
diff --git a/rust/bssl-tls/src/credentials/methods.rs b/rust/bssl-tls/src/credentials/methods.rs
index 3c55c75..6ca7449 100644
--- a/rust/bssl-tls/src/credentials/methods.rs
+++ b/rust/bssl-tls/src/credentials/methods.rs
@@ -12,11 +12,17 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use core::{ffi::c_int, ptr::null_mut};
+use core::{
+    ffi::c_int,
+    ptr::null_mut, //
+};
 
 use once_cell::sync::Lazy;
 
-use crate::{Methods, methods::drop_box_rust_methods};
+use crate::{
+    Methods,
+    methods::drop_box_rust_methods, //
+};
 
 pub(super) static TLS_CREDENTIAL_METHOD: Lazy<c_int> = Lazy::new(|| unsafe {
     // Safety: this a one-time registration uses only valid function pointers.
diff --git a/rust/bssl-tls/src/errors.rs b/rust/bssl-tls/src/errors.rs
index 0d181a5..dec5575 100644
--- a/rust/bssl-tls/src/errors.rs
+++ b/rust/bssl-tls/src/errors.rs
@@ -17,13 +17,25 @@
 use alloc::boxed::Box;
 use core::{
     any::Any,
-    ffi::{CStr, c_int, c_uint},
-    fmt::{Debug, Display, Formatter, Result as FmtResult},
+    ffi::{
+        CStr,
+        c_int,
+        c_uint, //
+    },
+    fmt::{
+        Debug,
+        Display,
+        Formatter,
+        Result as FmtResult, //
+    }, //
 };
 
 use bssl_macros::bssl_enum;
 use bssl_sys::LibCode;
-use bssl_x509::errors::{PemReason, PkiError};
+use bssl_x509::errors::{
+    PemReason,
+    PkiError, //
+};
 
 use crate::config::ConfigurationError;
 
diff --git a/rust/bssl-tls/src/ffi.rs b/rust/bssl-tls/src/ffi.rs
index dd42ec9..ddee76f 100644
--- a/rust/bssl-tls/src/ffi.rs
+++ b/rust/bssl-tls/src/ffi.rs
@@ -14,15 +14,25 @@
 
 use core::{
     marker::PhantomData,
-    ptr::{NonNull, null, null_mut},
-    slice::{from_raw_parts, from_raw_parts_mut},
+    ptr::{
+        NonNull,
+        null,
+        null_mut, //
+    },
+    slice::{
+        from_raw_parts,
+        from_raw_parts_mut, //
+    }, //
 };
 
 use bssl_crypto::FfiSlice;
 
 use crate::{
     context::CertificateCache,
-    errors::{Error, IoError},
+    errors::{
+        Error,
+        IoError, //
+    }, //
 };
 
 pub(crate) fn slice_into_ffi_raw_parts<T>(slice: &[T]) -> (*const T, usize) {
diff --git a/rust/bssl-tls/src/io.rs b/rust/bssl-tls/src/io.rs
index 7abd3a0..8c29fdb 100644
--- a/rust/bssl-tls/src/io.rs
+++ b/rust/bssl-tls/src/io.rs
@@ -16,18 +16,33 @@
 
 use alloc::boxed::Box;
 use core::{
-    ffi::{CStr, c_char, c_int, c_long, c_void},
+    ffi::{
+        CStr,
+        c_char,
+        c_int,
+        c_long,
+        c_void, //
+    },
     fmt,
     ptr::NonNull,
-    task::{Context, Waker},
+    task::{
+        Context,
+        Waker, //
+    },
 };
 
 use once_cell::sync::Lazy;
 
 use crate::{
     abort_on_panic,
-    errors::{Error, TlsRetryReason},
-    ffi::{sanitise_mut_byteslice, sanitize_slice},
+    errors::{
+        Error,
+        TlsRetryReason, //
+    },
+    ffi::{
+        sanitise_mut_byteslice,
+        sanitize_slice, //
+    },
 };
 
 /// A wrapper around a `dyn AbstractSocket`, delegating BIO methods to the
diff --git a/rust/bssl-tls/src/methods.rs b/rust/bssl-tls/src/methods.rs
index f605f44..228ac08 100644
--- a/rust/bssl-tls/src/methods.rs
+++ b/rust/bssl-tls/src/methods.rs
@@ -13,9 +13,16 @@
 // limitations under the License.
 
 use alloc::boxed::Box;
-use core::ffi::{c_int, c_long, c_void};
+use core::ffi::{
+    c_int,
+    c_long,
+    c_void, //
+};
 
-use crate::{Methods, abort_on_panic};
+use crate::{
+    Methods,
+    abort_on_panic, //
+};
 
 pub(crate) unsafe extern "C" fn drop_box_rust_methods<M: Methods>(
     _parent: *mut c_void,