From 8e187865560aaf5349f85c0e42babb08958883c2 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Fri, 24 Apr 2020 16:09:56 +0200 Subject: [PATCH] Run 'cargo fmt' --- build.rs | 3 ++- src/bin/bat/app.rs | 4 +--- src/bin/bat/assets.rs | 3 ++- src/bin/bat/config.rs | 3 ++- src/preprocessor.rs | 5 ++++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 4bf6173c..693826a1 100644 --- a/build.rs +++ b/build.rs @@ -19,7 +19,8 @@ fn main() -> Result<(), Box> { // Read environment variables. lazy_static! { static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat"); - static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE").unwrap_or(*PROJECT_NAME); + static ref EXECUTABLE_NAME: &'static str = + option_env!("PROJECT_EXECUTABLE").unwrap_or(*PROJECT_NAME); } /// Generates a file from a liquid template. diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 8eab9e45..d5751f73 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -250,9 +250,7 @@ impl App { .map(|values| values.collect()); let mut filenames_or_none: Box> = match filenames { - Some(ref filenames) => { - Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))) - } + Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))), None => Box::new(std::iter::repeat(None)), }; let files: Option> = self.matches.values_of_os("FILE").map(|vs| vs.collect()); diff --git a/src/bin/bat/assets.rs b/src/bin/bat/assets.rs index ead0b7cb..ef6484ab 100644 --- a/src/bin/bat/assets.rs +++ b/src/bin/bat/assets.rs @@ -53,5 +53,6 @@ pub fn assets_from_cache_or_binary() -> Result { } } - Ok(HighlightingAssets::from_cache(&cache_dir).unwrap_or_else(|_| HighlightingAssets::from_binary())) + Ok(HighlightingAssets::from_cache(&cache_dir) + .unwrap_or_else(|_| HighlightingAssets::from_binary())) } diff --git a/src/bin/bat/config.rs b/src/bin/bat/config.rs index 9b8c8925..03fdbff7 100644 --- a/src/bin/bat/config.rs +++ b/src/bin/bat/config.rs @@ -38,7 +38,8 @@ pub fn generate_config_file() -> bat::error::Result<()> { return Err(format!( "Unable to write config file to: {}", config_file.to_string_lossy() - ).into()); + ) + .into()); } } } diff --git a/src/preprocessor.rs b/src/preprocessor.rs index 373efc2f..f6c3d3f3 100644 --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -36,7 +36,10 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String { fn try_parse_utf8_char(input: &[u8]) -> Option<(char, usize)> { let str_from_utf8 = |seq| std::str::from_utf8(seq).ok(); - let decoded = input.get(0..1).and_then(str_from_utf8).map(|c| (c, 1)) + let decoded = input + .get(0..1) + .and_then(str_from_utf8) + .map(|c| (c, 1)) .or_else(|| input.get(0..2).and_then(str_from_utf8).map(|c| (c, 2))) .or_else(|| input.get(0..3).and_then(str_from_utf8).map(|c| (c, 3))) .or_else(|| input.get(0..4).and_then(str_from_utf8).map(|c| (c, 4)));