Format everything and add rustfmt to travis (#951)
* Format everything and add rustfmt to travis * Remove extern crate winit from examples and add force_multiline_blocks * Format the code properly * Fix inconsistent period in PULL_REQUEST_TEMPLATE.md * Only run rustfmt on nightly * Travis fixings
This commit is contained in:
parent
b1b5aefc4b
commit
e2c84725de
109 changed files with 4787 additions and 3679 deletions
|
|
@ -1,7 +1,4 @@
|
|||
use std::ptr;
|
||||
use std::fmt;
|
||||
use std::error::Error;
|
||||
use std::os::raw::c_int;
|
||||
use std::{error::Error, fmt, os::raw::c_int, ptr};
|
||||
|
||||
use libc;
|
||||
use parking_lot::Mutex;
|
||||
|
|
@ -27,7 +24,8 @@ pub struct XConnection {
|
|||
unsafe impl Send for XConnection {}
|
||||
unsafe impl Sync for XConnection {}
|
||||
|
||||
pub type XErrorHandler = Option<unsafe extern fn(*mut ffi::Display, *mut ffi::XErrorEvent) -> libc::c_int>;
|
||||
pub type XErrorHandler =
|
||||
Option<unsafe extern "C" fn(*mut ffi::Display, *mut ffi::XErrorEvent) -> libc::c_int>;
|
||||
|
||||
impl XConnection {
|
||||
pub fn new(error_handler: XErrorHandler) -> Result<XConnection, XNotSupported> {
|
||||
|
|
@ -53,9 +51,7 @@ impl XConnection {
|
|||
};
|
||||
|
||||
// Get X11 socket file descriptor
|
||||
let fd = unsafe {
|
||||
(xlib.XConnectionNumber)(display)
|
||||
};
|
||||
let fd = unsafe { (xlib.XConnectionNumber)(display) };
|
||||
|
||||
Ok(XConnection {
|
||||
xlib,
|
||||
|
|
@ -120,8 +116,11 @@ impl Error for XError {
|
|||
|
||||
impl fmt::Display for XError {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
write!(formatter, "X error: {} (code: {}, request code: {}, minor code: {})",
|
||||
self.description, self.error_code, self.request_code, self.minor_code)
|
||||
write!(
|
||||
formatter,
|
||||
"X error: {} (code: {}, request code: {}, minor code: {})",
|
||||
self.description, self.error_code, self.request_code, self.minor_code
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +130,7 @@ pub enum XNotSupported {
|
|||
/// Failed to load one or several shared libraries.
|
||||
LibraryOpenError(ffi::OpenError),
|
||||
/// Connecting to the X server with `XOpenDisplay` failed.
|
||||
XOpenDisplayFailed, // TODO: add better message
|
||||
XOpenDisplayFailed, // TODO: add better message
|
||||
}
|
||||
|
||||
impl From<ffi::OpenError> for XNotSupported {
|
||||
|
|
@ -154,7 +153,7 @@ impl Error for XNotSupported {
|
|||
fn cause(&self) -> Option<&dyn Error> {
|
||||
match *self {
|
||||
XNotSupported::LibraryOpenError(ref err) => Some(err),
|
||||
_ => None
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue