diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-01-13 10:01:18 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-01-15 23:21:39 +0100 |
commit | e370c1a34c4c8172a7439f0918539e999e270d56 (patch) | |
tree | 4b3035a8937c33cdaa6f17f960ff0a484522d4c5 /src | |
parent | 9d4d72effe8d6770a3c8558f3b41c88ff23dd5bd (diff) |
Fix clippy: this `else { if .. }` block can be collapsed
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/ui.rs | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 4f6a41f..d553d9f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,9 +35,9 @@ while_true, )] -extern crate log as logcrate; - #![allow(macro_use_extern_crate)] + +extern crate log as logcrate; #[macro_use] extern crate diesel; use std::path::Path; @@ -147,12 +147,10 @@ pub fn script_to_printable(script: &Script, highlight: bool, highlight_theme: &s } else { script.lines()?.join("") } + } else if line_numbers { + script.lines_numbered().map(|(i, s)| format!("{:>4} | {}", i, s)).join("") } else { - if line_numbers { - script.lines_numbered().map(|(i, s)| format!("{:>4} | {}", i, s)).join("") - } else { - script.to_string() - } + script.to_string() }; Ok(script) |