diff options
author | Pierre Peltier <pierre.peltier@adevinta.com> | 2019-10-30 10:17:02 +0100 |
---|---|---|
committer | Abin Simon <abinsimon10@gmail.com> | 2019-12-06 11:35:03 +0530 |
commit | 27f8fd3c6f46de6e2183e45de8abd2fa6280420d (patch) | |
tree | b454fe6c3f4d0e3cf19553a5922ce9390486553b | |
parent | c7236ea04b3da8a4eaa6b962844a1951195ce9a7 (diff) |
Run clippy
-rw-r--r-- | src/display.rs | 8 | ||||
-rw-r--r-- | src/flags.rs | 15 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/display.rs b/src/display.rs index 7db99df..4594dc1 100644 --- a/src/display.rs +++ b/src/display.rs @@ -132,7 +132,7 @@ fn inner_display_tree( 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) { 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 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; if depth > 0 { @@ -160,7 +160,7 @@ fn inner_display_tree( output += " "; } - output += lines.next().unwrap().clone(); + output += &String::from(lines.next().unwrap()); output += "\n"; if meta.content.is_some() { @@ -274,7 +274,7 @@ fn get_visible_width(input: &str) -> usize { let m_pos = s.find('m'); if let Some(len) = m_pos { - nb_invisible_char = nb_invisible_char + len + nb_invisible_char += len } } diff --git a/src/flags.rs b/src/flags.rs index b44b240..95a8f64 100644 --- a/src/flags.rs +++ b/src/flags.rs @@ -63,14 +63,13 @@ impl Flags { SortOrder::Default }; - let layout = if matches.is_present("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 { + 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 } else { Layout::Grid }; @@ -96,7 +95,7 @@ impl Flags { }; 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") { vec![ Block::Permission, |