clippy fixes

This commit is contained in:
Stephan Dilly 2020-05-02 16:55:20 +02:00
parent 7407d46557
commit 4df7704ef5
2 changed files with 4 additions and 4 deletions

View file

@ -173,7 +173,7 @@ pub fn get_diff(repo_path: &str, p: String, stage: bool) -> FileDiff {
repo_path.join(delta.new_file().path().unwrap()); repo_path.join(delta.new_file().path().unwrap());
let newfile_content = new_file_content(&newfile_path) let newfile_content = new_file_content(&newfile_path)
.unwrap_or(String::from("file not found")); .unwrap_or_else(|| String::from("file not found"));
let mut patch = Patch::from_buffers( let mut patch = Patch::from_buffers(
&[], &[],

View file

@ -166,7 +166,7 @@ impl ChangesComponent {
match &item.kind { match &item.kind {
FileTreeItemKind::File(status_item) => { FileTreeItemKind::File(status_item) => {
let status_char = let status_char =
Self::item_status_char(&status_item.status); Self::item_status_char(status_item.status);
let file = Path::new(&status_item.path) let file = Path::new(&status_item.path)
.file_name() .file_name()
.unwrap() .unwrap()
@ -182,7 +182,7 @@ impl ChangesComponent {
w = width as usize w = width as usize
) )
} else { } else {
format!("{} {}{}", status_char, indent_str, file) //M + - R format!("{} {}{}", status_char, indent_str, file)
}; };
let mut style = let mut style =
@ -239,7 +239,7 @@ impl ChangesComponent {
} }
} }
fn item_status_char(item_type: &Option<StatusItemType>) -> char { fn item_status_char(item_type: Option<StatusItemType>) -> char {
if let Some(item_type) = item_type { if let Some(item_type) = item_type {
match item_type { match item_type {
StatusItemType::Modified => 'M', StatusItemType::Modified => 'M',