@@ -78,9 +78,16 @@ fn huge_quick_xml(bencher: &mut Bencher) {
7878
7979fn tiny_roxmltree ( bencher : & mut Bencher ) {
8080 let text = std:: fs:: read_to_string ( "fonts.conf" ) . unwrap ( ) ;
81- let mut opt = roxmltree:: ParsingOptions :: default ( ) ;
82- opt. allow_dtd = true ;
83- bencher. iter ( || roxmltree:: Document :: parse_with_options ( & text, opt) . unwrap ( ) )
81+ bencher. iter ( || {
82+ roxmltree:: Document :: parse_with_options (
83+ & text,
84+ roxmltree:: ParsingOptions {
85+ allow_dtd : true ,
86+ ..Default :: default ( )
87+ } ,
88+ )
89+ . unwrap ( )
90+ } )
8491}
8592
8693fn medium_roxmltree ( bencher : & mut Bencher ) {
@@ -100,9 +107,16 @@ fn huge_roxmltree(bencher: &mut Bencher) {
100107
101108fn gigantic_roxmltree ( bencher : & mut Bencher ) {
102109 let text = std:: fs:: read_to_string ( "gigantic.svg" ) . unwrap ( ) ;
103- let mut opt = roxmltree:: ParsingOptions :: default ( ) ;
104- opt. allow_dtd = true ;
105- bencher. iter ( || roxmltree:: Document :: parse_with_options ( & text, opt) . unwrap ( ) )
110+ bencher. iter ( || {
111+ roxmltree:: Document :: parse_with_options (
112+ & text,
113+ roxmltree:: ParsingOptions {
114+ allow_dtd : true ,
115+ ..Default :: default ( )
116+ } ,
117+ )
118+ . unwrap ( )
119+ } )
106120}
107121
108122fn cdata_roxmltree ( bencher : & mut Bencher ) {
@@ -112,16 +126,30 @@ fn cdata_roxmltree(bencher: &mut Bencher) {
112126
113127fn text_roxmltree ( bencher : & mut Bencher ) {
114128 let text = std:: fs:: read_to_string ( "text.xml" ) . unwrap ( ) ;
115- let mut opt = roxmltree:: ParsingOptions :: default ( ) ;
116- opt. allow_dtd = true ;
117- bencher. iter ( || roxmltree:: Document :: parse_with_options ( & text, opt) . unwrap ( ) )
129+ bencher. iter ( || {
130+ roxmltree:: Document :: parse_with_options (
131+ & text,
132+ roxmltree:: ParsingOptions {
133+ allow_dtd : true ,
134+ ..Default :: default ( )
135+ } ,
136+ )
137+ . unwrap ( )
138+ } )
118139}
119140
120141fn attributes_roxmltree ( bencher : & mut Bencher ) {
121142 let text = std:: fs:: read_to_string ( "attributes.xml" ) . unwrap ( ) ;
122- let mut opt = roxmltree:: ParsingOptions :: default ( ) ;
123- opt. allow_dtd = true ;
124- bencher. iter ( || roxmltree:: Document :: parse_with_options ( & text, opt) . unwrap ( ) )
143+ bencher. iter ( || {
144+ roxmltree:: Document :: parse_with_options (
145+ & text,
146+ roxmltree:: ParsingOptions {
147+ allow_dtd : true ,
148+ ..Default :: default ( )
149+ } ,
150+ )
151+ . unwrap ( )
152+ } )
125153}
126154
127155fn tiny_xmltree ( bencher : & mut Bencher ) {
0 commit comments