File tree 2 files changed +9
-30
lines changed
2 files changed +9
-30
lines changed Original file line number Diff line number Diff line change @@ -53,22 +53,11 @@ fn format_label(
53
53
) -> Vec < DisplayTextFragment < ' _ > > {
54
54
let mut result = vec ! [ ] ;
55
55
if let Some ( label) = label {
56
- for ( idx, element) in label. split ( "__" ) . enumerate ( ) {
57
- let element_style = match style {
58
- Some ( s) => s,
59
- None => {
60
- if idx % 2 == 0 {
61
- DisplayTextStyle :: Regular
62
- } else {
63
- DisplayTextStyle :: Emphasis
64
- }
65
- }
66
- } ;
67
- result. push ( DisplayTextFragment {
68
- content : element,
69
- style : element_style,
70
- } ) ;
71
- }
56
+ let element_style = style. unwrap_or ( DisplayTextStyle :: Regular ) ;
57
+ result. push ( DisplayTextFragment {
58
+ content : label,
59
+ style : element_style,
60
+ } ) ;
72
61
}
73
62
result
74
63
}
Original file line number Diff line number Diff line change @@ -262,20 +262,10 @@ fn test_format_label() {
262
262
annotation: dl:: Annotation {
263
263
annotation_type: dl:: DisplayAnnotationType :: Error ,
264
264
id: None ,
265
- label: vec![
266
- dl:: DisplayTextFragment {
267
- content: "This " ,
268
- style: dl:: DisplayTextStyle :: Regular ,
269
- } ,
270
- dl:: DisplayTextFragment {
271
- content: "is" ,
272
- style: dl:: DisplayTextStyle :: Emphasis ,
273
- } ,
274
- dl:: DisplayTextFragment {
275
- content: " a title" ,
276
- style: dl:: DisplayTextStyle :: Regular ,
277
- } ,
278
- ] ,
265
+ label: vec![ dl:: DisplayTextFragment {
266
+ content: "This __is__ a title" ,
267
+ style: dl:: DisplayTextStyle :: Regular ,
268
+ } ] ,
279
269
} ,
280
270
source_aligned: true ,
281
271
continuation: false ,
You can’t perform that action at this time.
0 commit comments