diff options
author | sharkdp <davidpeter@web.de> | 2020-10-11 21:57:12 +0200 |
---|---|---|
committer | sharkdp <davidpeter@web.de> | 2020-10-11 21:57:12 +0200 |
commit | b3903175c8b5d72c0a9dc428d77bec01bdc349fa (patch) | |
tree | ed96d0a71820f42df378a5525efbbf9f84806fd6 /src | |
parent | de47bd2323d2b4a2e551022430c28e52274856d8 (diff) |
Auto-format Rust code
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/bat/config.rs | 3 | ||||
-rw-r--r-- | src/output.rs | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/bin/bat/config.rs b/src/bin/bat/config.rs index c7ce08d5..1f20a6f0 100644 --- a/src/bin/bat/config.rs +++ b/src/bin/bat/config.rs @@ -44,8 +44,7 @@ pub fn generate_config_file() -> bat::error::Result<()> { } } - let default_config = - r#"# This is `bat`s configuration file. Each line either contains a comment or + let default_config = r#"# This is `bat`s configuration file. Each line either contains a comment or # a command-line option that you want to pass to `bat` by default. You can # run `bat --help` to get a list of all possible configuration options. diff --git a/src/output.rs b/src/output.rs index 8bbdbc61..b0d5974e 100644 --- a/src/output.rs +++ b/src/output.rs @@ -10,7 +10,6 @@ use crate::paging::PagingMode; #[cfg(feature = "paging")] use crate::wrapping::WrappingMode; - #[cfg(feature = "paging")] #[derive(Debug, PartialEq)] enum SingleScreenAction { @@ -18,7 +17,6 @@ enum SingleScreenAction { Nothing, } - #[derive(Debug)] pub enum OutputType { #[cfg(feature = "paging")] @@ -28,11 +26,17 @@ pub enum OutputType { impl OutputType { #[cfg(feature = "paging")] - pub fn from_mode(paging_mode: PagingMode, wrapping_mode: WrappingMode, pager: Option<&str>) -> Result<Self> { + pub fn from_mode( + paging_mode: PagingMode, + wrapping_mode: WrappingMode, + pager: Option<&str>, + ) -> Result<Self> { use self::PagingMode::*; Ok(match paging_mode { Always => OutputType::try_pager(SingleScreenAction::Nothing, wrapping_mode, pager)?, - QuitIfOneScreen => OutputType::try_pager(SingleScreenAction::Quit, wrapping_mode, pager)?, + QuitIfOneScreen => { + OutputType::try_pager(SingleScreenAction::Quit, wrapping_mode, pager)? + } _ => OutputType::stdout(), }) } @@ -42,7 +46,7 @@ impl OutputType { fn try_pager( single_screen_action: SingleScreenAction, wrapping_mode: WrappingMode, - pager_from_config: Option<&str> + pager_from_config: Option<&str>, ) -> Result<Self> { use std::env; use std::ffi::OsString; |