Fix clippy warnings

pull/150/head
Florian Dehau 6 years ago
parent 6d594143ed
commit a74d335cb4

@ -54,7 +54,7 @@ impl Backend for CursesBackend {
for (col, row, cell) in content {
// eprintln!("{:?}", cell);
if row != last_row || col != last_col + 1 {
self.curses.move_rc(row as i32, col as i32);
self.curses.move_rc(i32::from(row), i32::from(col));
}
last_col = col;
last_row = row;
@ -111,7 +111,7 @@ impl Backend for CursesBackend {
Ok((x as u16, y as u16))
}
fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
self.curses.move_rc(x as i32, y as i32);
self.curses.move_rc(i32::from(x), i32::from(y));
Ok(())
}
fn clear(&mut self) -> io::Result<()> {

@ -103,7 +103,7 @@ impl Into<rustbox::Color> for Color {
Color::Cyan | Color::LightCyan => rustbox::Color::Cyan,
Color::White => rustbox::Color::White,
Color::Blue | Color::LightBlue => rustbox::Color::Blue,
Color::Indexed(i) => rustbox::Color::Byte(i as u16),
Color::Indexed(i) => rustbox::Color::Byte(u16::from(i)),
Color::Rgb(r, g, b) => rustbox::Color::Byte(rgb_to_byte(r, g, b)),
}
}

@ -26,7 +26,7 @@ pub enum Color {
impl Color {
/// Returns a short code associated with the color, used for debug purpose
/// only
pub(crate) fn code(&self) -> &str {
pub(crate) fn code(self) -> &'static str {
match self {
Color::Reset => "X",
Color::Black => "b",
@ -68,7 +68,7 @@ bitflags! {
impl Modifier {
/// Returns a short code associated with the color, used for debug purpose
/// only
pub(crate) fn code(&self) -> String {
pub(crate) fn code(self) -> String {
use std::fmt::Write;
let mut result = String::new();

@ -1,5 +1,5 @@
use std::iter;
use std::iter::Iterator;
use std::convert::AsRef;
use std::iter::{self, Iterator};
use unicode_width::UnicodeWidthStr;
@ -166,7 +166,7 @@ impl<'b> SelectableList<'b> {
where
I: AsRef<str> + 'b,
{
self.items = items.iter().map(|i| i.as_ref()).collect::<Vec<&str>>();
self.items = items.iter().map(AsRef::as_ref).collect::<Vec<&str>>();
self
}

Loading…
Cancel
Save