1- use std:: ffi:: { CString , CStr } ;
1+ use std:: ffi:: { CStr , CString } ;
22
33/// A `dlerror` error.
44pub struct DlDescription ( pub ( crate ) CString ) ;
@@ -31,49 +31,49 @@ pub enum Error {
3131 /// The `dlopen` call failed.
3232 DlOpen {
3333 /// The source error.
34- desc : DlDescription
34+ desc : DlDescription ,
3535 } ,
3636 /// The `dlopen` call failed and system did not report an error.
3737 DlOpenUnknown ,
3838 /// The `dlsym` call failed.
3939 DlSym {
4040 /// The source error.
41- desc : DlDescription
41+ desc : DlDescription ,
4242 } ,
4343 /// The `dlsym` call failed and system did not report an error.
4444 DlSymUnknown ,
4545 /// The `dlclose` call failed.
4646 DlClose {
4747 /// The source error.
48- desc : DlDescription
48+ desc : DlDescription ,
4949 } ,
5050 /// The `dlclose` call failed and system did not report an error.
5151 DlCloseUnknown ,
5252 /// The `LoadLibraryW` call failed.
5353 LoadLibraryExW {
5454 /// The source error.
55- source : WindowsError
55+ source : WindowsError ,
5656 } ,
5757 /// The `LoadLibraryW` call failed and system did not report an error.
5858 LoadLibraryExWUnknown ,
5959 /// The `GetModuleHandleExW` call failed.
6060 GetModuleHandleExW {
6161 /// The source error.
62- source : WindowsError
62+ source : WindowsError ,
6363 } ,
6464 /// The `GetModuleHandleExW` call failed and system did not report an error.
6565 GetModuleHandleExWUnknown ,
6666 /// The `GetProcAddress` call failed.
6767 GetProcAddress {
6868 /// The source error.
69- source : WindowsError
69+ source : WindowsError ,
7070 } ,
7171 /// The `GetProcAddressUnknown` call failed and system did not report an error.
7272 GetProcAddressUnknown ,
7373 /// The `FreeLibrary` call failed.
7474 FreeLibrary {
7575 /// The source error.
76- source : WindowsError
76+ source : WindowsError ,
7777 } ,
7878 /// The `FreeLibrary` call failed and system did not report an error.
7979 FreeLibraryUnknown ,
@@ -82,12 +82,12 @@ pub enum Error {
8282 /// Could not create a new CString.
8383 CreateCString {
8484 /// The source error.
85- source : std:: ffi:: NulError
85+ source : std:: ffi:: NulError ,
8686 } ,
8787 /// Could not create a new CString from bytes with trailing null.
8888 CreateCStringWithTrailing {
8989 /// The source error.
90- source : std:: ffi:: FromBytesWithNulError
90+ source : std:: ffi:: FromBytesWithNulError ,
9191 } ,
9292}
9393
@@ -117,20 +117,29 @@ impl std::fmt::Display for Error {
117117 DlClose { ref desc } => write ! ( f, "{}" , desc. 0 . to_string_lossy( ) ) ,
118118 DlCloseUnknown => write ! ( f, "dlclose failed, but system did not report the error" ) ,
119119 LoadLibraryExW { .. } => write ! ( f, "LoadLibraryExW failed" ) ,
120- LoadLibraryExWUnknown =>
121- write ! ( f, "LoadLibraryExW failed, but system did not report the error" ) ,
120+ LoadLibraryExWUnknown => write ! (
121+ f,
122+ "LoadLibraryExW failed, but system did not report the error"
123+ ) ,
122124 GetModuleHandleExW { .. } => write ! ( f, "GetModuleHandleExW failed" ) ,
123- GetModuleHandleExWUnknown =>
124- write ! ( f, "GetModuleHandleExWUnknown failed, but system did not report the error" ) ,
125+ GetModuleHandleExWUnknown => write ! (
126+ f,
127+ "GetModuleHandleExWUnknown failed, but system did not report the error"
128+ ) ,
125129 GetProcAddress { .. } => write ! ( f, "GetProcAddress failed" ) ,
126- GetProcAddressUnknown =>
127- write ! ( f, "GetProcAddress failed, but system did not report the error" ) ,
130+ GetProcAddressUnknown => write ! (
131+ f,
132+ "GetProcAddress failed, but system did not report the error"
133+ ) ,
128134 FreeLibrary { .. } => write ! ( f, "FreeLibrary failed" ) ,
129- FreeLibraryUnknown =>
130- write ! ( f, "FreeLibrary failed, but system did not report the error" ) ,
135+ FreeLibraryUnknown => {
136+ write ! ( f, "FreeLibrary failed, but system did not report the error" )
137+ }
131138 CreateCString { .. } => write ! ( f, "could not create a C string from bytes" ) ,
132- CreateCStringWithTrailing { .. } =>
133- write ! ( f, "could not create a C string from bytes with trailing null" ) ,
139+ CreateCStringWithTrailing { .. } => write ! (
140+ f,
141+ "could not create a C string from bytes with trailing null"
142+ ) ,
134143 IncompatibleSize => write ! ( f, "requested type cannot possibly work" ) ,
135144 }
136145 }
0 commit comments