1
+ #![ allow( clippy:: unit_arg) ]
1
2
#[ macro_use]
2
3
extern crate criterion;
3
4
4
- use criterion:: black_box;
5
- use criterion:: Criterion ;
5
+ use criterion:: { black_box, Criterion } ;
6
6
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
+ } ;
10
11
11
12
fn create_snippet ( ) {
12
13
let snippet = Snippet {
@@ -46,7 +47,7 @@ fn create_snippet() {
46
47
SourceAnnotation {
47
48
label: "expected enum `std::option::Option`" . to_string( ) ,
48
49
annotation_type: AnnotationType :: Error ,
49
- range: ( 23 , 745 ) ,
50
+ range: ( 26 , 724 ) ,
50
51
} ,
51
52
] ,
52
53
} ] ,
@@ -56,11 +57,14 @@ fn create_snippet() {
56
57
annotation_type : AnnotationType :: Error ,
57
58
} ) ,
58
59
footer : vec ! [ ] ,
60
+ opt : FormatOptions {
61
+ color : true ,
62
+ ..Default :: default ( )
63
+ } ,
59
64
} ;
60
65
61
66
let dl = DisplayList :: from ( snippet) ;
62
- let dlf = DisplayListFormatter :: new ( true , false ) ;
63
- let _result = dlf. format ( & dl) ;
67
+ let _result = dl. to_string ( ) ;
64
68
}
65
69
66
70
pub fn criterion_benchmark ( c : & mut Criterion ) {
0 commit comments