Skip to content

Commit 7ad61cd

Browse files
author
Zibi Braniecki
committed
Use unwrap_or_default
1 parent 958ae92 commit 7ad61cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/display_list/from_snippet.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn format_label(label: Option<&str>, style: Option<DisplayTextStyle>) -> Vec<Dis
2525
}
2626

2727
fn format_title(annotation: &snippet::Annotation) -> DisplayLine {
28-
let label = annotation.label.clone().unwrap_or("".to_string());
28+
let label = annotation.label.clone().unwrap_or_default();
2929
DisplayLine::Raw(DisplayRawLine::Annotation {
3030
annotation: Annotation {
3131
annotation_type: DisplayAnnotationType::from(annotation.annotation_type),
@@ -39,7 +39,7 @@ fn format_title(annotation: &snippet::Annotation) -> DisplayLine {
3939

4040
fn format_annotation(annotation: &snippet::Annotation) -> Vec<DisplayLine> {
4141
let mut result = vec![];
42-
let label = annotation.label.clone().unwrap_or("".to_string());
42+
let label = annotation.label.clone().unwrap_or_default();
4343
for (i, line) in label.lines().enumerate() {
4444
result.push(DisplayLine::Raw(DisplayRawLine::Annotation {
4545
annotation: Annotation {

0 commit comments

Comments
 (0)