on master help sign in
Use deref coercion to simplify some argument passing
4baa346Marcin Puc
src/input.rs+1−1
@@ -50,7 +50,7 @@ impl InputDescription {
50 }
50 }
51
51
52 pub fn title(&self) -> &String {
52 pub fn title(&self) -> &String {
53− match self.title.as_ref() {
53+ match &self.title {
54 Some(title) => title,
54 Some(title) => title,
55 None => &self.name,
55 None => &self.name,
56 }
56 }
src/printer.rs+1−1
@@ -395,7 +395,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
395 return Ok(());
395 return Ok(());
396 }
396 }
397 };
397 };
398− highlighter.highlight(line.as_ref(), self.syntax_set)
398+ highlighter.highlight(&line, self.syntax_set)
399 };
399 };
400
400
401 if out_of_range {
401 if out_of_range {
src/syntax_mapping.rs+1−1
@@ -151,7 +151,7 @@ impl<'a> SyntaxMapping<'a> {
151 }
151 }
152
152
153 pub(crate) fn get_syntax_for(&self, path: impl AsRef<Path>) -> Option<MappingTarget<'a>> {
153 pub(crate) fn get_syntax_for(&self, path: impl AsRef<Path>) -> Option<MappingTarget<'a>> {
154− let candidate = Candidate::new(path.as_ref());
154+ let candidate = Candidate::new(&path);
155 let candidate_filename = path.as_ref().file_name().map(Candidate::new);
155 let candidate_filename = path.as_ref().file_name().map(Candidate::new);
156 for (ref glob, ref syntax) in self.mappings.iter().rev() {
156 for (ref glob, ref syntax) in self.mappings.iter().rev() {
157 if glob.is_match_candidate(&candidate)
157 if glob.is_match_candidate(&candidate)