@@ -83,16 +83,15 @@ pub fn diagnostic<'doc>(
84 let diagnostics_on_line = after.chain(before);
84 let diagnostics_on_line = after.chain(before);
86− // This unwrap is safe because the iterator cannot be empty as it contains at least the item found by the binary search.
87− let diagnostic = diagnostics_on_line.max_by_key(|d| d.severity).unwrap();
86+ if let Some(diagnostic) = diagnostics_on_line.max_by_key(|d| d.severity) {
89− write!(out, "●").unwrap();
87+ write!(out, "●").ok();
90− return Some(match diagnostic.severity {
88+ return Some(match diagnostic.severity {
91− Some(Severity::Error) => error,
89+ Some(Severity::Error) => error,
92− Some(Severity::Warning) | None => warning,
90+ Some(Severity::Warning) | None => warning,
93− Some(Severity::Info) => info,
91+ Some(Severity::Info) => info,
94− Some(Severity::Hint) => hint,
92+ Some(Severity::Hint) => hint,