Clippy fixes!
This commit is contained in:
parent
49187d53f2
commit
4e1f4c8cd7
|
@ -713,7 +713,8 @@ fn rgb_from_hex<D>(deserializer: &mut D) -> ::std::result::Result<Rgb, D::Error>
|
|||
deserializer.deserialize_str(RgbVisitor)
|
||||
}
|
||||
|
||||
impl Rgb {
|
||||
impl FromStr for Rgb {
|
||||
type Err = ();
|
||||
fn from_str(s: &str) -> ::std::result::Result<Rgb, ()> {
|
||||
let mut chars = s.chars();
|
||||
let mut rgb = Rgb::default();
|
||||
|
|
|
@ -153,12 +153,10 @@ impl<N: Notify> Processor<N> {
|
|||
processor.ctx.terminal.dirty = true;
|
||||
}
|
||||
},
|
||||
glutin::Event::Focused(true) => {
|
||||
processor.ctx.terminal.dirty = true;
|
||||
},
|
||||
glutin::Event::MouseWheel(scroll_delta, touch_phase) => {
|
||||
processor.on_mouse_wheel(scroll_delta, touch_phase);
|
||||
},
|
||||
glutin::Event::Focused(true) |
|
||||
glutin::Event::Refresh |
|
||||
glutin::Event::Awakened => {
|
||||
processor.ctx.terminal.dirty = true;
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Ord for Point {
|
|||
use std::cmp::Ordering::*;
|
||||
match (self.line.cmp(&other.line), self.col.cmp(&other.col)) {
|
||||
(Equal, Equal) => Equal,
|
||||
(Equal, ord) => ord,
|
||||
(Equal, ord) |
|
||||
(ord, Equal) => ord,
|
||||
(Less, _) => Less,
|
||||
(Greater, _) => Greater,
|
||||
|
@ -314,7 +314,7 @@ impl<T: PartialOrd<T>> Contains for Range<T> {
|
|||
impl<T: PartialOrd<T>> Contains for RangeInclusive<T> {
|
||||
type Content = T;
|
||||
fn contains_(&self, item: Self::Content) -> bool {
|
||||
if let &RangeInclusive::NonEmpty{ref start, ref end} = self {
|
||||
if let RangeInclusive::NonEmpty{ref start, ref end} = *self {
|
||||
(*start <= item) && (item <= *end)
|
||||
} else { false }
|
||||
}
|
||||
|
|
|
@ -209,11 +209,10 @@ impl<'a, N: Notify + 'a> Processor<'a, N> {
|
|||
line: point.line,
|
||||
col: point.col
|
||||
}, self.ctx.mouse.cell_side);
|
||||
} else if self.ctx.terminal.mode().contains(mode::MOUSE_MOTION) {
|
||||
// Only report motion when changing cells
|
||||
if prev_line != self.ctx.mouse.line || prev_col != self.ctx.mouse.column {
|
||||
self.mouse_report(0 + 32);
|
||||
}
|
||||
} else if self.ctx.terminal.mode().contains(mode::MOUSE_MOTION)
|
||||
// Only report motion when changing cells
|
||||
&& (prev_line != self.ctx.mouse.line || prev_col != self.ctx.mouse.column) {
|
||||
self.mouse_report(32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
//! Alacritty - The GPU Enhanced Terminal
|
||||
#![feature(plugin)]
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
||||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate alacritty;
|
||||
|
|
|
@ -106,14 +106,14 @@ impl Selection {
|
|||
|
||||
// Single-cell selections are a special case
|
||||
if start == end {
|
||||
if start_side != end_side {
|
||||
if start_side == end_side {
|
||||
return None;
|
||||
} else {
|
||||
return Some(Span {
|
||||
ty: SpanType::Inclusive,
|
||||
front: *front,
|
||||
tail: *tail
|
||||
});
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ impl Cell {
|
|||
#[inline]
|
||||
pub fn reset(&mut self, template: &Cell) {
|
||||
// memcpy template to self
|
||||
*self = template.clone();
|
||||
*self = *template;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -306,7 +306,7 @@ impl Term {
|
|||
mode: Default::default(),
|
||||
scroll_region: scroll_region,
|
||||
size_info: size,
|
||||
template_cell: template.clone(),
|
||||
template_cell: template,
|
||||
empty_cell: template,
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ impl Term {
|
|||
println!("num_cols, num_lines = {}, {}", num_cols, num_lines);
|
||||
|
||||
// Resize grids to new size
|
||||
let template = self.template_cell.clone();
|
||||
let template = self.template_cell;
|
||||
self.grid.resize(num_lines, num_cols, &template);
|
||||
self.alt_grid.resize(num_lines, num_cols, &template);
|
||||
|
||||
|
@ -514,7 +514,7 @@ impl Term {
|
|||
self.tabs[0] = false;
|
||||
|
||||
// Make sure bottom of terminal is clear
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
self.grid.clear_region((self.cursor.line).., |c| c.reset(&template));
|
||||
self.alt_grid.clear_region((self.cursor.line).., |c| c.reset(&template));
|
||||
|
||||
|
@ -538,7 +538,7 @@ impl Term {
|
|||
::std::mem::swap(&mut self.cursor, &mut self.alt_cursor);
|
||||
|
||||
if self.alt {
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
self.grid.clear(|c| c.reset(&template));
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ impl Term {
|
|||
debug_println!("scroll_down: {}", lines);
|
||||
|
||||
// Copy of cell template; can't have it borrowed when calling clear/scroll
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
|
||||
// Clear `lines` lines at bottom of area
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ impl Term {
|
|||
debug_println!("scroll_up: {}", lines);
|
||||
|
||||
// Copy of cell template; can't have it borrowed when calling clear/scroll
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
|
||||
// Clear `lines` lines starting from origin to origin + lines
|
||||
{
|
||||
|
@ -636,7 +636,7 @@ impl ansi::Handler for Term {
|
|||
}
|
||||
|
||||
let cell = &mut self.grid[&self.cursor];
|
||||
*cell = self.template_cell.clone();
|
||||
*cell = self.template_cell;
|
||||
cell.c = c;
|
||||
self.cursor.col += 1;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ impl ansi::Handler for Term {
|
|||
|
||||
// Cells were just moved out towards the end of the line; fill in
|
||||
// between source and dest with blanks.
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
for c in &mut line[source..destination] {
|
||||
c.reset(&template);
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ impl ansi::Handler for Term {
|
|||
let end = start + count;
|
||||
|
||||
let row = &mut self.grid[self.cursor.line];
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
for c in &mut row[start..end] {
|
||||
c.reset(&template);
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ impl ansi::Handler for Term {
|
|||
|
||||
// Clear last `count` cells in line. If deleting 1 char, need to delete
|
||||
// 1 cell.
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
let end = self.size_info.cols() - count;
|
||||
for c in &mut line[end..] {
|
||||
c.reset(&template);
|
||||
|
@ -891,7 +891,7 @@ impl ansi::Handler for Term {
|
|||
#[inline]
|
||||
fn clear_line(&mut self, mode: ansi::LineClearMode) {
|
||||
debug_println!("clear_line: {:?}", mode);
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
match mode {
|
||||
ansi::LineClearMode::Right => {
|
||||
let row = &mut self.grid[self.cursor.line];
|
||||
|
@ -917,7 +917,7 @@ impl ansi::Handler for Term {
|
|||
#[inline]
|
||||
fn clear_screen(&mut self, mode: ansi::ClearMode) {
|
||||
debug_println!("clear_screen: {:?}", mode);
|
||||
let template = self.empty_cell.clone();
|
||||
let template = self.empty_cell;
|
||||
match mode {
|
||||
ansi::ClearMode::Below => {
|
||||
for row in &mut self.grid[self.cursor.line..] {
|
||||
|
|
|
@ -15,6 +15,7 @@ use std::cmp;
|
|||
|
||||
#[cfg(not(feature = "nightly"))]
|
||||
#[inline(always)]
|
||||
#[cfg_attr(feature = "clippy", allow(inline_always))]
|
||||
pub unsafe fn unlikely(x: bool) -> bool {
|
||||
x
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue