avoid many &str to String conversions with MultiSpan::push_span_label

This commit is contained in:
Takayuki Maeda 2022-06-29 21:16:43 +09:00
parent 0e1a6fb463
commit 6212e6b339
17 changed files with 38 additions and 66 deletions

View file

@ -136,7 +136,7 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
let mut msp = MultiSpan::from_span(primary_span);
for span_label in span_labels {
let span = make_span(&file_text, &span_label.start, &span_label.end);
msp.push_span_label(span, span_label.label.to_string());
msp.push_span_label(span, span_label.label);
println!("span: {:?} label: {:?}", span, span_label.label);
println!("text: {:?}", source_map.span_to_snippet(span));
}