Skip to content

Commit 559e465

Browse files
djcnagisa
authored andcommitted
Format with cargo fmt
1 parent db35813 commit 559e465

File tree

5 files changed

+153
-113
lines changed

5 files changed

+153
-113
lines changed

src/error.rs

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::ffi::{CString, CStr};
1+
use std::ffi::{CStr, CString};
22

33
/// A `dlerror` error.
44
pub 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
}

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@
3535
//!
3636
//! The compiler will ensure that the loaded function will not outlive the `Library` from which it comes,
3737
//! preventing the most common memory-safety issues.
38-
#![cfg_attr(any(unix, windows), deny(missing_docs, clippy::all, unreachable_pub, unused))]
38+
#![cfg_attr(
39+
any(unix, windows),
40+
deny(missing_docs, clippy::all, unreachable_pub, unused)
41+
)]
3942
#![cfg_attr(libloading_docs, feature(doc_cfg))]
4043

4144
pub mod changelog;
42-
pub mod os;
43-
mod util;
4445
mod error;
46+
pub mod os;
4547
#[cfg(any(unix, windows, libloading_docs))]
4648
mod safe;
49+
mod util;
4750

4851
pub use self::error::Error;
4952
#[cfg(any(unix, windows, libloading_docs))]

0 commit comments

Comments
 (0)