Run `cargo fmt`

This commit is contained in:
Lena 2024-01-03 21:27:53 +01:00
parent c0a7130d1e
commit 50ab049366
No known key found for this signature in database
GPG Key ID: BF30558F199B4027
7 changed files with 20 additions and 12 deletions

View File

@ -453,7 +453,11 @@ mod tests {
mapping: &SyntaxMapping,
) -> String {
self.assets
.get_syntax(language, input, mapping).map_or_else(|_| "!no syntax!".to_owned(), |syntax_in_set| syntax_in_set.syntax.name.clone())
.get_syntax(language, input, mapping)
.map_or_else(
|_| "!no syntax!".to_owned(),
|syntax_in_set| syntax_in_set.syntax.name.clone(),
)
}
fn syntax_for_real_file_with_content_os(

View File

@ -24,7 +24,8 @@ pub fn system_config_file() -> PathBuf {
pub fn config_file() -> PathBuf {
env::var("BAT_CONFIG_PATH")
.ok().map_or_else(|| PROJECT_DIRS.config_dir().join("config"), PathBuf::from)
.ok()
.map_or_else(|| PROJECT_DIRS.config_dir().join("config"), PathBuf::from)
}
pub fn generate_config_file() -> bat::error::Result<()> {

View File

@ -43,7 +43,8 @@ const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.
#[cfg(feature = "build-assets")]
fn build_assets(matches: &clap::ArgMatches, config_dir: &Path, cache_dir: &Path) -> Result<()> {
let source_dir = matches
.get_one::<String>("source").map_or_else(|| config_dir, Path::new);
.get_one::<String>("source")
.map_or_else(|| config_dir, Path::new);
bat::assets::build(
source_dir,
@ -60,7 +61,8 @@ fn run_cache_subcommand(
default_cache_dir: &Path,
) -> Result<()> {
let cache_dir = matches
.get_one::<String>("target").map_or_else(|| default_cache_dir, Path::new);
.get_one::<String>("target")
.map_or_else(|| default_cache_dir, Path::new);
if matches.get_flag("build") {
#[cfg(feature = "build-assets")]

View File

@ -154,9 +154,7 @@ impl<'b> Controller<'b> {
// Skip files without Git modifications
if self.config.visible_lines.diff_mode()
&& diff
.as_ref()
.is_some_and(|changes| changes.is_empty())
&& diff.as_ref().is_some_and(|changes| changes.is_empty())
{
return Ok(());
}

View File

@ -123,7 +123,8 @@ impl OutputType {
};
Ok(p.stdin(Stdio::piped())
.spawn().map_or_else(|_| OutputType::stdout(), OutputType::Pager))
.spawn()
.map_or_else(|_| OutputType::stdout(), OutputType::Pager))
}
pub(crate) fn stdout() -> Self {

View File

@ -48,8 +48,8 @@ impl PagerKind {
let current_bin = env::args_os().next();
// Check if the current running binary is set to be our pager.
let is_current_bin_pager = current_bin
.is_some_and(|s| Path::new(&s).file_stem() == pager_bin);
let is_current_bin_pager =
current_bin.is_some_and(|s| Path::new(&s).file_stem() == pager_bin);
match pager_bin.map(|s| s.to_string_lossy()).as_deref() {
Some("less") => PagerKind::Less,

View File

@ -385,14 +385,16 @@ impl<'a> Printer for InteractivePrinter<'a> {
handle,
"{}{}{}",
description
.kind().map_or_else(String::new, |kind| format!("{kind}: ")),
.kind()
.map_or_else(String::new, |kind| format!("{kind}: ")),
self.colors.header_value.paint(description.title()),
mode
),
StyleComponent::HeaderFilesize => {
let bsize = metadata
.size.map_or_else(|| "-".into(), |s| format!("{}", ByteSize(s)));
.size
.map_or_else(|| "-".into(), |s| format!("{}", ByteSize(s)));
writeln!(handle, "Size: {}", self.colors.header_value.paint(bsize))
}
_ => Ok(()),