diff --git a/cli/src/highlight.rs b/cli/src/highlight.rs index 0f88149a..6cd19392 100644 --- a/cli/src/highlight.rs +++ b/cli/src/highlight.rs @@ -195,7 +195,7 @@ pub fn ansi( let stdout = io::stdout(); let mut stdout = stdout.lock(); let mut scope_stack = Vec::new(); - for event in highlight(source, language, property_sheet, &|s| { + for event in highlight(source, language, property_sheet, |s| { language_for_injection_string(loader, s) })? { match event { @@ -258,8 +258,8 @@ pub fn html( source, language, property_sheet, - &|s| language_for_injection_string(loader, s), - &|scope| { + |s| language_for_injection_string(loader, s), + |scope| { if let Some(css_style) = theme.css_style(scope) { css_style } else { diff --git a/highlight/src/lib.rs b/highlight/src/lib.rs index 453685f4..bbe0b424 100644 --- a/highlight/src/lib.rs +++ b/highlight/src/lib.rs @@ -84,7 +84,7 @@ struct Highlighter<'a, T> where T: Fn(&str) -> Option<(Language, &'a PropertySheet)>, { - injection_callback: &'a T, + injection_callback: T, source: &'a [u8], source_offset: usize, parser: Parser, @@ -353,7 +353,7 @@ where source: &'a [u8], language: Language, property_sheet: &'a PropertySheet, - injection_callback: &'a F, + injection_callback: F, ) -> Result { let mut parser = Parser::new(); parser.set_language(language)?; @@ -742,10 +742,10 @@ pub fn highlight<'a, F>( source: &'a [u8], language: Language, property_sheet: &'a PropertySheet, - injection_callback: &'a F, + injection_callback: F, ) -> Result> + 'a, String> where - F: Fn(&str) -> Option<(Language, &'a PropertySheet)>, + F: Fn(&str) -> Option<(Language, &'a PropertySheet)> + 'a, { Highlighter::new(source, language, property_sheet, injection_callback) } @@ -754,8 +754,8 @@ pub fn highlight_html<'a, F1, F2>( source: &'a [u8], language: Language, property_sheet: &'a PropertySheet, - injection_callback: &'a F1, - attribute_callback: &'a F2, + injection_callback: F1, + attribute_callback: F2, ) -> Result, String> where F1: Fn(&str) -> Option<(Language, &'a PropertySheet)>,