cargo fmt

This commit is contained in:
sharkdp 2020-04-11 19:40:04 +02:00
parent fccbe4f4f2
commit 495fab24a5
4 changed files with 20 additions and 6 deletions

2
Cargo.lock generated
View File

@ -490,7 +490,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]

View File

@ -17,7 +17,10 @@ pub fn config_file() -> PathBuf {
pub fn generate_config_file() -> bat::errors::Result<()> {
let config_file = config_file();
if config_file.exists() {
println!("A config file already exists at: {}", config_file.to_string_lossy());
println!(
"A config file already exists at: {}",
config_file.to_string_lossy()
);
print!("Overwrite? (y/N): ");
io::stdout().flush()?;
@ -31,7 +34,12 @@ pub fn generate_config_file() -> bat::errors::Result<()> {
let config_dir = config_file.parent();
match config_dir {
Some(path) => fs::create_dir_all(path)?,
None => return Ok(Err(format!("Unable to write config file to: {}", config_file.to_string_lossy()))?),
None => {
return Ok(Err(format!(
"Unable to write config file to: {}",
config_file.to_string_lossy()
))?)
}
}
}
@ -54,7 +62,10 @@ pub fn generate_config_file() -> bat::errors::Result<()> {
"#;
fs::write(&config_file, default_config)?;
println!("Success! Config file written to {}", config_file.to_string_lossy());
println!(
"Success! Config file written to {}",
config_file.to_string_lossy()
);
return Ok(());
}

View File

@ -17,7 +17,10 @@ use std::process;
use ansi_term::Colour::Green;
use ansi_term::Style;
use crate::{app::App, config::{config_file, generate_config_file}};
use crate::{
app::App,
config::{config_file, generate_config_file},
};
use assets::{assets_from_cache_or_binary, cache_dir, clear_assets, config_dir};
use bat::Controller;
use directories::PROJECT_DIRS;

View File

@ -21,9 +21,9 @@ use unicode_width::UnicodeWidthChar;
use crate::assets::HighlightingAssets;
use crate::config::Config;
use crate::decorations::{Decoration, GridBorderDecoration, LineNumberDecoration};
#[cfg(feature = "git")]
use crate::decorations::LineChangesDecoration;
use crate::decorations::{Decoration, GridBorderDecoration, LineNumberDecoration};
#[cfg(feature = "git")]
use crate::diff::{get_git_diff, LineChanges};
use crate::errors::*;