mirror of
https://github.com/fdehau/tui-rs.git
synced 2024-11-11 01:10:24 +00:00
Fix clippy warnings
This commit is contained in:
parent
6d594143ed
commit
a74d335cb4
@ -54,7 +54,7 @@ impl Backend for CursesBackend {
|
|||||||
for (col, row, cell) in content {
|
for (col, row, cell) in content {
|
||||||
// eprintln!("{:?}", cell);
|
// eprintln!("{:?}", cell);
|
||||||
if row != last_row || col != last_col + 1 {
|
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_col = col;
|
||||||
last_row = row;
|
last_row = row;
|
||||||
@ -111,7 +111,7 @@ impl Backend for CursesBackend {
|
|||||||
Ok((x as u16, y as u16))
|
Ok((x as u16, y as u16))
|
||||||
}
|
}
|
||||||
fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn clear(&mut self) -> io::Result<()> {
|
fn clear(&mut self) -> io::Result<()> {
|
||||||
|
@ -103,7 +103,7 @@ impl Into<rustbox::Color> for Color {
|
|||||||
Color::Cyan | Color::LightCyan => rustbox::Color::Cyan,
|
Color::Cyan | Color::LightCyan => rustbox::Color::Cyan,
|
||||||
Color::White => rustbox::Color::White,
|
Color::White => rustbox::Color::White,
|
||||||
Color::Blue | Color::LightBlue => rustbox::Color::Blue,
|
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)),
|
Color::Rgb(r, g, b) => rustbox::Color::Byte(rgb_to_byte(r, g, b)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ pub enum Color {
|
|||||||
impl Color {
|
impl Color {
|
||||||
/// Returns a short code associated with the color, used for debug purpose
|
/// Returns a short code associated with the color, used for debug purpose
|
||||||
/// only
|
/// only
|
||||||
pub(crate) fn code(&self) -> &str {
|
pub(crate) fn code(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Color::Reset => "X",
|
Color::Reset => "X",
|
||||||
Color::Black => "b",
|
Color::Black => "b",
|
||||||
@ -68,7 +68,7 @@ bitflags! {
|
|||||||
impl Modifier {
|
impl Modifier {
|
||||||
/// Returns a short code associated with the color, used for debug purpose
|
/// Returns a short code associated with the color, used for debug purpose
|
||||||
/// only
|
/// only
|
||||||
pub(crate) fn code(&self) -> String {
|
pub(crate) fn code(self) -> String {
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::iter;
|
use std::convert::AsRef;
|
||||||
use std::iter::Iterator;
|
use std::iter::{self, Iterator};
|
||||||
|
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ impl<'b> SelectableList<'b> {
|
|||||||
where
|
where
|
||||||
I: AsRef<str> + 'b,
|
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
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user