1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00

Fix clippy warnings

This commit is contained in:
Christian Duerr 2019-11-02 01:25:34 +01:00 committed by GitHub
parent 3e5511a693
commit 356e418636
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View file

@ -265,13 +265,10 @@ impl Options {
config.hold = self.hold; config.hold = self.hold;
config.window.dimensions = self.dimensions.unwrap_or(config.window.dimensions); config.window.dimensions = self.dimensions.unwrap_or(config.window.dimensions);
config.window.title = self.title.unwrap_or(config.window.title);
config.window.position = self.position.or(config.window.position); config.window.position = self.position.or(config.window.position);
config.window.embed = self.embed.and_then(|embed| embed.parse().ok()); config.window.embed = self.embed.and_then(|embed| embed.parse().ok());
if let Some(title) = self.title {
config.window.title = title.clone();
}
if let Some(class) = self.class { if let Some(class) = self.class {
let parts: Vec<_> = class.split(',').collect(); let parts: Vec<_> = class.split(',').collect();
config.window.class.instance = parts[0].into(); config.window.class.instance = parts[0].into();

View file

@ -1,3 +1,4 @@
use std::cmp::Ordering;
/// Wrapper around Vec which supports fast indexing and rotation /// Wrapper around Vec which supports fast indexing and rotation
/// ///
/// The rotation implemented by grid::Storage is a simple integer addition. /// The rotation implemented by grid::Storage is a simple integer addition.
@ -94,10 +95,10 @@ impl<T> Storage<T> {
T: Clone, T: Clone,
{ {
let current_history = self.len - (self.visible_lines.0 + 1); let current_history = self.len - (self.visible_lines.0 + 1);
if history_size > current_history { match history_size.cmp(&current_history) {
self.grow_lines(history_size - current_history, template_row); Ordering::Greater => self.grow_lines(history_size - current_history, template_row),
} else if history_size < current_history { Ordering::Less => self.shrink_lines(current_history - history_size),
self.shrink_lines(current_history - history_size); _ => (),
} }
} }

View file

@ -37,6 +37,12 @@ pub fn create_clipboards(display: &Display) -> (Primary, Clipboard) {
(Primary { context: context.clone() }, Clipboard { context }) (Primary { context: context.clone() }, Clipboard { context })
} }
/// Create new clipboard from a raw display pointer.
///
/// # Safety
///
/// Since the type of the display is a raw pointer, it's the responsibility of the callee to make
/// sure that the passed pointer is a valid Wayland display.
pub unsafe fn create_clipboards_from_external(display: *mut c_void) -> (Primary, Clipboard) { pub unsafe fn create_clipboards_from_external(display: *mut c_void) -> (Primary, Clipboard) {
let context = let context =
Arc::new(Mutex::new(WaylandClipboard::new_from_external(display as *mut wl_display))); Arc::new(Mutex::new(WaylandClipboard::new_from_external(display as *mut wl_display)));