Run clippy

This commit is contained in:
Pierre Peltier 2019-10-30 10:17:02 +01:00 committed by Abin Simon
parent c7236ea04b
commit 27f8fd3c6f
2 changed files with 11 additions and 12 deletions

View file

@ -132,7 +132,7 @@ fn inner_display_tree(
direction: Direction::LeftToRight, direction: Direction::LeftToRight,
}); });
for meta in metas.into_iter() { for meta in metas.iter() {
for block in get_output(&meta, &colors, &icons, &flags, &padding_rules) { for block in get_output(&meta, &colors, &icons, &flags, &padding_rules) {
let block_str = block.to_string(); let block_str = block.to_string();
@ -146,7 +146,7 @@ fn inner_display_tree(
let content = grid.fit_into_columns(flags.blocks.len()).to_string(); let content = grid.fit_into_columns(flags.blocks.len()).to_string();
let mut lines = content.lines(); let mut lines = content.lines();
for (idx, meta) in metas.into_iter().enumerate() { for (idx, meta) in metas.iter().enumerate() {
let is_last_folder_elem = idx + 1 != last_idx; let is_last_folder_elem = idx + 1 != last_idx;
if depth > 0 { if depth > 0 {
@ -160,7 +160,7 @@ fn inner_display_tree(
output += " "; output += " ";
} }
output += lines.next().unwrap().clone(); output += &String::from(lines.next().unwrap());
output += "\n"; output += "\n";
if meta.content.is_some() { if meta.content.is_some() {
@ -274,7 +274,7 @@ fn get_visible_width(input: &str) -> usize {
let m_pos = s.find('m'); let m_pos = s.find('m');
if let Some(len) = m_pos { if let Some(len) = m_pos {
nb_invisible_char = nb_invisible_char + len nb_invisible_char += len
} }
} }

View file

@ -63,14 +63,13 @@ impl Flags {
SortOrder::Default SortOrder::Default
}; };
let layout = if matches.is_present("tree") { let layout = if matches.is_present("long")
|| matches.is_present("oneline")
|| blocks_inputs.len() > 1
{
Layout::OneLine
} else if matches.is_present("tree") {
Layout::Tree Layout::Tree
} else if matches.is_present("long") {
Layout::OneLine
} else if matches.is_present("oneline") {
Layout::OneLine
} else if blocks_inputs.len() > 1 {
Layout::OneLine
} else { } else {
Layout::Grid Layout::Grid
}; };
@ -96,7 +95,7 @@ impl Flags {
}; };
let blocks: Vec<Block> = if !blocks_inputs.is_empty() { let blocks: Vec<Block> = if !blocks_inputs.is_empty() {
blocks_inputs.into_iter().map(|b| Block::from(b)).collect() blocks_inputs.into_iter().map(Block::from).collect()
} else if matches.is_present("long") { } else if matches.is_present("long") {
vec![ vec![
Block::Permission, Block::Permission,