mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-19 04:21:06 +00:00
Use deref coercion to simplify some argument passing
This commit is contained in:
parent
7956485e37
commit
4baa346aae
@ -50,7 +50,7 @@ impl InputDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn title(&self) -> &String {
|
pub fn title(&self) -> &String {
|
||||||
match self.title.as_ref() {
|
match &self.title {
|
||||||
Some(title) => title,
|
Some(title) => title,
|
||||||
None => &self.name,
|
None => &self.name,
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
highlighter.highlight(line.as_ref(), self.syntax_set)
|
highlighter.highlight(&line, self.syntax_set)
|
||||||
};
|
};
|
||||||
|
|
||||||
if out_of_range {
|
if out_of_range {
|
||||||
|
@ -151,7 +151,7 @@ impl<'a> SyntaxMapping<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_syntax_for(&self, path: impl AsRef<Path>) -> Option<MappingTarget<'a>> {
|
pub(crate) fn get_syntax_for(&self, path: impl AsRef<Path>) -> Option<MappingTarget<'a>> {
|
||||||
let candidate = Candidate::new(path.as_ref());
|
let candidate = Candidate::new(&path);
|
||||||
let candidate_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() {
|
for (ref glob, ref syntax) in self.mappings.iter().rev() {
|
||||||
if glob.is_match_candidate(&candidate)
|
if glob.is_match_candidate(&candidate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user