2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-16 21:25:56 +00:00
This commit is contained in:
Kienyew 2020-08-06 15:20:33 +08:00 committed by David Peter
parent b3657aef2b
commit cab5ddf6ae

View File

@ -94,10 +94,10 @@ impl<'a> SyntaxMapping<'a> {
pub(crate) fn get_syntax_for(&self, path: impl AsRef<Path>) -> Option<MappingTarget<'a>> {
let candidate = Candidate::new(path.as_ref());
let canddidate_filename = path.as_ref().file_name().map(Candidate::new);
let candidate_filename = path.as_ref().file_name().map(Candidate::new);
for (ref glob, ref syntax) in self.mappings.iter().rev() {
if glob.is_match_candidate(&candidate)
|| canddidate_filename
|| candidate_filename
.as_ref()
.map_or(false, |filename| glob.is_match_candidate(filename))
{