From e370c1a34c4c8172a7439f0918539e999e270d56 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 13 Jan 2021 10:01:18 +0100 Subject: Fix clippy: this `else { if .. }` block can be collapsed Signed-off-by: Matthias Beyer --- src/main.rs | 4 ++-- src/ui.rs | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') 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; diff --git a/src/ui.rs b/src/ui.rs index 7b73e92..0b95403 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -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) -- cgit v1.2.3