Skip to content

Commit 24c3056

Browse files
committed
refactor(render): Decouple title from Label
1 parent 0d1364d commit 24c3056

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/renderer/display_list.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,7 @@ impl<'a> DisplayList<'a> {
119119
) -> DisplayList<'a> {
120120
let mut body = vec![];
121121

122-
body.push(format_title(
123-
snippet::Label {
124-
level,
125-
label: title,
126-
},
127-
id,
128-
));
122+
body.push(format_title(level, id, title));
129123

130124
for (idx, snippet) in snippets.into_iter().enumerate() {
131125
body.append(&mut format_slice(
@@ -740,12 +734,12 @@ fn format_label(
740734
result
741735
}
742736

743-
fn format_title<'a>(title: snippet::Label<'a>, id: Option<&'a str>) -> DisplayLine<'a> {
737+
fn format_title<'a>(level: crate::Level, id: Option<&'a str>, label: &'a str) -> DisplayLine<'a> {
744738
DisplayLine::Raw(DisplayRawLine::Annotation {
745739
annotation: Annotation {
746-
annotation_type: DisplayAnnotationType::from(title.level),
740+
annotation_type: DisplayAnnotationType::from(level),
747741
id,
748-
label: format_label(Some(title.label), Some(DisplayTextStyle::Emphasis)),
742+
label: format_label(Some(label), Some(DisplayTextStyle::Emphasis)),
749743
},
750744
source_aligned: false,
751745
continuation: false,

0 commit comments

Comments
 (0)