pedantic clippy

This commit is contained in:
Stephan Dilly 2020-04-02 23:45:50 +02:00
parent 77cafbd6b7
commit bc85a86000
4 changed files with 10 additions and 8 deletions

View file

@ -89,7 +89,9 @@ impl ChangesComponent {
i = cmp::min(i + delta, max - 1);
i = cmp::max(i, 0);
self.selection = Some(i as usize);
if let Ok(i) = usize::try_from(i) {
self.selection = Some(i);
}
}
}
}

View file

@ -5,7 +5,7 @@ use crate::{
};
use asyncgit::{hash, Diff, DiffLine, DiffLineType};
use crossterm::event::{Event, KeyCode};
use std::{borrow::Cow, cmp};
use std::{borrow::Cow, cmp, convert::TryFrom};
use tui::{
backend::Backend,
layout::{Alignment, Rect},
@ -82,7 +82,7 @@ impl DiffComponent {
break;
}
let hunk_len = hunk.0.len() as u16;
let hunk_len = u16::try_from(hunk.0.len()).unwrap();
let hunk_min = line_cursor;
let hunk_max = line_cursor + hunk_len;

View file

@ -1,7 +1,7 @@
#![forbid(unsafe_code)]
#![deny(clippy::all)]
// #![warn(clippy::cargo)]
#![deny(clippy::cast_possible_wrap)]
#![deny(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
mod app;
mod components;

View file

@ -12,10 +12,10 @@ pub static CMD_STATUS_UNSTAGE: &str = "Unstage File [enter]";
pub static CMD_STATUS_RESET: &str = "Reset File [D]";
pub static CMD_STATUS_QUIT: &str = "Quit [esc,q]";
pub static CMD_STATUS_HELP: &str = "Help [h]";
pub static CMD_STATUS_LEFT: &str = "Back [←]";
pub static CMD_STATUS_RIGHT: &str = "Diff [→]";
pub static CMD_STATUS_LEFT: &str = "Back [\u{2190}]"; //←
pub static CMD_STATUS_RIGHT: &str = "Diff [\u{2192}]"; //→
pub static CMD_SPLITTER: &str = " ";
pub static CMD_SCROLL: &str = "Scroll [↑↓]";
pub static CMD_SCROLL: &str = "Scroll [\u{2191}\u{2193}]"; //↑↓
pub static COMMIT_TITLE: &str = "Commit";
pub static COMMIT_MSG: &str = "type commit message..";