fix inactive-by-default features

This commit is contained in:
The-Minecraft-Scientist 2024-11-22 16:19:45 -08:00
parent f40ea26aef
commit d9897b47e3
4 changed files with 5 additions and 5 deletions

View File

@ -1183,7 +1183,7 @@ impl GraphicalReportHandler {
&'a self, &'a self,
source: &'a dyn SourceCode, source: &'a dyn SourceCode,
context_span: &'a SourceSpan, context_span: &'a SourceSpan,
) -> Result<(Box<dyn SpanContents<'a> + 'a>, Vec<Line>), fmt::Error> { ) -> Result<(Box<dyn SpanContents + 'a>, Vec<Line>), fmt::Error> {
let context_data = source let context_data = source
.read_span(context_span, self.context_lines, self.context_lines) .read_span(context_span, self.context_lines, self.context_lines)
.map_err(|_| fmt::Error)?; .map_err(|_| fmt::Error)?;

View File

@ -12,7 +12,7 @@ pub struct BlankHighlighter;
impl Highlighter for BlankHighlighter { impl Highlighter for BlankHighlighter {
fn start_highlighter_state<'h>( fn start_highlighter_state<'h>(
&'h self, &'h self,
_source: &dyn SpanContents<'_>, _source: &(dyn SpanContents + 'h),
) -> Box<dyn super::HighlighterState + 'h> { ) -> Box<dyn super::HighlighterState + 'h> {
Box::new(BlankHighlighterState) Box::new(BlankHighlighterState)
} }

View File

@ -39,7 +39,7 @@ pub trait Highlighter {
/// responsible for the actual rendering. /// responsible for the actual rendering.
fn start_highlighter_state<'h>( fn start_highlighter_state<'h>(
&'h self, &'h self,
source: &dyn SpanContents<'_>, source: &(dyn SpanContents + 'h),
) -> Box<dyn HighlighterState + 'h>; ) -> Box<dyn HighlighterState + 'h>;
} }

View File

@ -42,7 +42,7 @@ impl Default for SyntectHighlighter {
impl Highlighter for SyntectHighlighter { impl Highlighter for SyntectHighlighter {
fn start_highlighter_state<'h>( fn start_highlighter_state<'h>(
&'h self, &'h self,
source: &dyn SpanContents<'_>, source: &(dyn SpanContents + 'h),
) -> Box<dyn HighlighterState + 'h> { ) -> Box<dyn HighlighterState + 'h> {
if let Some(syntax) = self.detect_syntax(source) { if let Some(syntax) = self.detect_syntax(source) {
let highlighter = syntect::Highlighter::new(&self.theme); let highlighter = syntect::Highlighter::new(&self.theme);
@ -82,7 +82,7 @@ impl SyntectHighlighter {
} }
/// Determine syntect [`SyntaxReference`] to use for given [`SpanContents`]. /// Determine syntect [`SyntaxReference`] to use for given [`SpanContents`].
fn detect_syntax(&self, contents: &dyn SpanContents<'_>) -> Option<&syntect::SyntaxReference> { fn detect_syntax(&self, contents: &dyn SpanContents) -> Option<&syntect::SyntaxReference> {
// use language if given // use language if given
if let Some(language) = contents.language() { if let Some(language) = contents.language() {
return self.syntax_set.find_syntax_by_name(language); return self.syntax_set.find_syntax_by_name(language);