From 25034f8d4d70b4048d7540264fc18461982406aa Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Fri, 3 Jun 2016 16:25:16 -0300 Subject: Add Clippy as dependency. This brings a lot of clean up on the code. --- src/safe_x11/mod.rs | 5 +++-- src/safe_x11/window.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/safe_x11') diff --git a/src/safe_x11/mod.rs b/src/safe_x11/mod.rs index 3d08a4e..613424a 100644 --- a/src/safe_x11/mod.rs +++ b/src/safe_x11/mod.rs @@ -74,13 +74,13 @@ pub fn close_display(display: *mut Display) { unsafe { xlib::XCloseDisplay(display); } } -/// Get the file descriptor for the XServer +/// Get the file descriptor for the `XServer` pub fn x11_fd(display: *mut Display) -> c_int { unsafe { XConnectionNumber(display) } } /// Get the next event from the xserver. This call will not block forever -/// (like XNextEvent), instead it will wait for a certain time (1 second +/// (like `XNextEvent`), instead it will wait for a certain time (1 second /// for now, but it can change) so we're not blocking the socket interface /// on the main thread. pub fn next_xevent(display: *mut Display) -> XEvent { @@ -124,6 +124,7 @@ pub fn root_window(display: *mut Display) -> Window { /// 0, 0 /// ); /// ``` +#[allow(too_many_arguments)] pub fn grab_button(display: *mut Display, button: u32, modifiers: u32, owner_events: bool, event_mask: i64, pointer_mode: i32, keyboard_mode: i32, confine_to: Window, diff --git a/src/safe_x11/window.rs b/src/safe_x11/window.rs index 6d1e54e..eac4dbd 100644 --- a/src/safe_x11/window.rs +++ b/src/safe_x11/window.rs @@ -260,7 +260,7 @@ impl XWindow { .next() { let diff = attrs.width - (*v - attrs.x); if *v - attrs.x > 0 { - let _ = self.resize_to(attrs.width - diff, attrs.height); + self.resize_to(attrs.width - diff, attrs.height); } } } @@ -273,7 +273,7 @@ impl XWindow { .skip_while(|&a| *a <= win_bound) .next() { let new_width = *v - attrs.x; - let _ = self.resize_to(new_width, attrs.height); + self.resize_to(new_width, attrs.height); } } @@ -285,7 +285,7 @@ impl XWindow { .next() { let diff = attrs.height - (*v - attrs.y); if *v - attrs.y > 0 { - let _ = self.resize_to(attrs.width, attrs.height - diff); + self.resize_to(attrs.width, attrs.height - diff); } } } @@ -298,7 +298,7 @@ impl XWindow { .skip_while(|&a| *a <= win_bound) .next() { let new_height = *v - attrs.y; - let _ = self.resize_to(attrs.width, new_height); + self.resize_to(attrs.width, new_height); } } @@ -363,8 +363,8 @@ impl XWindow { let gc = xlib::XCreateGC(self.display, self.inner, 0, ptr::null_mut()); xlib::XSetForeground(self.display, gc, XWhitePixel(self.display, 0)); xlib::XSetBackground(self.display, gc, XBlackPixel(self.display, 0)); - println!("Loading fixed"); - let font: xlib::XFontStruct = ptr::read(xlib::XLoadQueryFont(self.display, CString::new("fixed").unwrap().as_ptr())); + let cstring = CString::new("fixed").unwrap(); + let font: xlib::XFontStruct = ptr::read(xlib::XLoadQueryFont(self.display, cstring.as_ptr())); xlib::XSetFont(self.display, gc, font.fid); xlib::XClearWindow(self.display, self.inner); XDrawString(self.display, self.inner, gc, -- cgit v1.2.3-70-g09d2