mirror of
https://github.com/sharkdp/bat.git
synced 2025-04-14 14:50:40 +01:00
Run cargo fmt
This commit is contained in:
parent
a4b674902f
commit
33c11d64f0
@ -25,11 +25,17 @@ pub struct HighlightingAssets {
|
|||||||
|
|
||||||
const IGNORED_SUFFIXES: [&str; 10] = [
|
const IGNORED_SUFFIXES: [&str; 10] = [
|
||||||
// Editor etc backups
|
// Editor etc backups
|
||||||
"~", ".bak", ".old", ".orig",
|
"~",
|
||||||
|
".bak",
|
||||||
|
".old",
|
||||||
|
".orig",
|
||||||
// Debian and derivatives apt/dpkg backups
|
// Debian and derivatives apt/dpkg backups
|
||||||
".dpkg-dist", ".dpkg-old",
|
".dpkg-dist",
|
||||||
|
".dpkg-old",
|
||||||
// Red Hat and derivatives rpm backups
|
// Red Hat and derivatives rpm backups
|
||||||
".rpmnew", ".rpmorig", ".rpmsave",
|
".rpmnew",
|
||||||
|
".rpmorig",
|
||||||
|
".rpmsave",
|
||||||
// Build system input/template files
|
// Build system input/template files
|
||||||
".in",
|
".in",
|
||||||
];
|
];
|
||||||
@ -285,21 +291,24 @@ impl HighlightingAssets {
|
|||||||
.find_syntax_by_extension(file_name.to_str().unwrap_or_default())
|
.find_syntax_by_extension(file_name.to_str().unwrap_or_default())
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
let file_path = Path::new(file_name);
|
let file_path = Path::new(file_name);
|
||||||
self.syntax_set.find_syntax_by_extension(
|
self.syntax_set
|
||||||
file_path
|
.find_syntax_by_extension(
|
||||||
.extension()
|
file_path
|
||||||
.and_then(|x| x.to_str())
|
.extension()
|
||||||
.unwrap_or_default(),
|
.and_then(|x| x.to_str())
|
||||||
).or_else(|| {
|
.unwrap_or_default(),
|
||||||
if let Some(file_str) = file_path.to_str() {
|
)
|
||||||
for suffix in IGNORED_SUFFIXES.iter() {
|
.or_else(|| {
|
||||||
if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
|
if let Some(file_str) = file_path.to_str() {
|
||||||
return self.get_extension_syntax(OsStr::new(stripped_filename));
|
for suffix in IGNORED_SUFFIXES.iter() {
|
||||||
|
if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
|
||||||
|
return self
|
||||||
|
.get_extension_syntax(OsStr::new(stripped_filename));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
None
|
||||||
None
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user