Simplify code for special case of annotation

This commit is contained in:
AnthonyMikh 2019-09-30 23:33:17 +03:00 committed by GitHub
parent 75a7c27a54
commit 7dc953b493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -622,8 +622,7 @@ impl EmitterWriter {
// 3 | |
// 4 | | }
// | |_^ test
if line.annotations.len() == 1 {
if let Some(ref ann) = line.annotations.get(0) {
if let [ann] = &line.annotations[..] {
if let AnnotationType::MultilineStart(depth) = ann.annotation_type {
if source_string.chars().take(ann.start_col).all(|c| c.is_whitespace()) {
let style = if ann.is_primary {
@ -636,7 +635,6 @@ impl EmitterWriter {
}
}
}
}
// We want to display like this:
//