mirror of
https://github.com/sharkdp/bat
synced 2026-08-02 18:41:42 +00:00
Merge branch 'master' into master
This commit is contained in:
+2
-2
@@ -96,7 +96,7 @@ impl App {
|
||||
Ok(clap_app::build_app(interactive_output).get_matches_from(args))
|
||||
}
|
||||
|
||||
pub fn config(&self, inputs: &[Input]) -> Result<Config> {
|
||||
pub fn config(&self, inputs: &[Input]) -> Result<Config<'_>> {
|
||||
let style_components = self.style_components()?;
|
||||
|
||||
let extra_plain = self.matches.get_count("plain") > 1;
|
||||
@@ -338,7 +338,7 @@ impl App {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn inputs(&self) -> Result<Vec<Input>> {
|
||||
pub fn inputs(&self) -> Result<Vec<Input<'_>>> {
|
||||
let filenames: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.get_many::<PathBuf>("file-name")
|
||||
|
||||
@@ -50,7 +50,7 @@ fn clear_asset(path: PathBuf, description: &str) {
|
||||
println!("skipped (not present)");
|
||||
}
|
||||
Err(err) => {
|
||||
println!("could not remove the cache file {:?}: {}", &path, err);
|
||||
println!("could not remove the cache file {path:?}: {err}");
|
||||
}
|
||||
Ok(_) => println!("okay"),
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ static VERSION: Lazy<String> = Lazy::new(|| {
|
||||
if git_version.is_empty() {
|
||||
crate_version!().to_string()
|
||||
} else {
|
||||
format!("{} ({})", crate_version!(), git_version)
|
||||
format!("{} ({git_version})", crate_version!())
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -88,9 +88,8 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
||||
|
||||
fs::write(&config_file, default_config).map_err(|e| {
|
||||
format!(
|
||||
"Failed to create config file at '{}': {}",
|
||||
"Failed to create config file at '{}': {e}",
|
||||
config_file.to_string_lossy(),
|
||||
e
|
||||
)
|
||||
})?;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ pub fn new_file_input<'a>(file: &'a Path, name: Option<&'a Path>) -> Input<'a> {
|
||||
named(Input::ordinary_file(file), name.or(Some(file)))
|
||||
}
|
||||
|
||||
pub fn new_stdin_input(name: Option<&Path>) -> Input {
|
||||
pub fn new_stdin_input(name: Option<&Path>) -> Input<'_> {
|
||||
named(Input::stdin(), name)
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -162,7 +162,7 @@ pub fn get_languages(config: &Config, cache_dir: &Path) -> Result<String> {
|
||||
};
|
||||
|
||||
for lang in languages {
|
||||
write!(result, "{:width$}{}", lang.name, separator, width = longest).ok();
|
||||
write!(result, "{:width$}{separator}", lang.name, width = longest).ok();
|
||||
|
||||
// Number of characters on this line so far, wrap before `desired_width`
|
||||
let mut num_chars = 0;
|
||||
@@ -173,7 +173,7 @@ pub fn get_languages(config: &Config, cache_dir: &Path) -> Result<String> {
|
||||
let new_chars = word.len() + comma_separator.len();
|
||||
if num_chars + new_chars >= desired_width {
|
||||
num_chars = 0;
|
||||
write!(result, "\n{:width$}{}", "", separator, width = longest).ok();
|
||||
write!(result, "\n{:width$}{separator}", "", width = longest).ok();
|
||||
}
|
||||
|
||||
num_chars += new_chars;
|
||||
@@ -224,9 +224,8 @@ pub fn list_themes(
|
||||
if config.colored_output {
|
||||
writeln!(
|
||||
writer,
|
||||
"Theme: {}{}\n",
|
||||
"Theme: {}{default_theme_info}\n",
|
||||
Style::new().bold().paint(theme.to_string()),
|
||||
default_theme_info
|
||||
)?;
|
||||
config.theme = theme.to_string();
|
||||
Controller::new(&config, &assets)
|
||||
@@ -363,7 +362,7 @@ fn run() -> Result<bool> {
|
||||
"fish" => println!("{}", completions::FISH_COMPLETION),
|
||||
"ps1" => println!("{}", completions::PS1_COMPLETION),
|
||||
"zsh" => println!("{}", completions::ZSH_COMPLETION),
|
||||
_ => unreachable!("No completion for shell '{}' available.", shell),
|
||||
_ => unreachable!("No completion for shell '{shell}' available."),
|
||||
}
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user