1+ #![ allow( clippy:: unit_arg) ]
12#[ macro_use]
23extern crate criterion;
34
4- use criterion:: black_box;
5- use criterion:: Criterion ;
5+ use criterion:: { black_box, Criterion } ;
66
7- use annotate_snippets:: display_list:: DisplayList ;
8- use annotate_snippets:: formatter:: DisplayListFormatter ;
9- use annotate_snippets:: snippet:: { Annotation , AnnotationType , Slice , Snippet , SourceAnnotation } ;
7+ use annotate_snippets:: {
8+ display_list:: { DisplayList , FormatOptions } ,
9+ snippet:: { Annotation , AnnotationType , Slice , Snippet , SourceAnnotation } ,
10+ } ;
1011
1112fn create_snippet ( ) {
1213 let snippet = Snippet {
@@ -46,7 +47,7 @@ fn create_snippet() {
4647 SourceAnnotation {
4748 label: "expected enum `std::option::Option`" . to_string( ) ,
4849 annotation_type: AnnotationType :: Error ,
49- range: ( 23 , 745 ) ,
50+ range: ( 26 , 724 ) ,
5051 } ,
5152 ] ,
5253 } ] ,
@@ -56,11 +57,14 @@ fn create_snippet() {
5657 annotation_type : AnnotationType :: Error ,
5758 } ) ,
5859 footer : vec ! [ ] ,
60+ opt : FormatOptions {
61+ color : true ,
62+ ..Default :: default ( )
63+ } ,
5964 } ;
6065
6166 let dl = DisplayList :: from ( snippet) ;
62- let dlf = DisplayListFormatter :: new ( true , false ) ;
63- let _result = dlf. format ( & dl) ;
67+ let _result = dl. to_string ( ) ;
6468}
6569
6670pub fn criterion_benchmark ( c : & mut Criterion ) {
0 commit comments