1- use regex:: { Regex , RegexBuilder } ;
21use askama:: Template ;
2+ use regex:: { Regex , RegexBuilder } ;
33
44use crate :: module:: { Input , ModuleType } ;
55
@@ -48,7 +48,6 @@ struct ReferenceTemplate<'a> {
4848 examples : bool ,
4949}
5050
51-
5251// We're implementing the template functions on the Input struct, not on Module,
5352// because the templating happens at the point when newdoc composes the text of the module,
5453// which is part of the module creation. The module then stores the rendered template.
@@ -79,23 +78,28 @@ impl Input {
7978 module_title : & self . title ,
8079 include_statements : & self . includes_block ( ) ,
8180 examples : self . options . examples ,
82- } . render ( ) ,
81+ }
82+ . render ( ) ,
8383 ModuleType :: Concept => ConceptTemplate {
8484 module_id : & self . id ( ) ,
8585 module_title : & self . title ,
8686 examples : self . options . examples ,
87- } . render ( ) ,
87+ }
88+ . render ( ) ,
8889 ModuleType :: Procedure => ProcedureTemplate {
8990 module_id : & self . id ( ) ,
9091 module_title : & self . title ,
9192 examples : self . options . examples ,
92- } . render ( ) ,
93+ }
94+ . render ( ) ,
9395 ModuleType :: Reference => ReferenceTemplate {
9496 module_id : & self . id ( ) ,
9597 module_title : & self . title ,
9698 examples : self . options . examples ,
97- } . render ( ) ,
98- } . expect ( "Failed to construct the document from the template" ) ;
99+ }
100+ . render ( ) ,
101+ }
102+ . expect ( "Failed to construct the document from the template" ) ;
99103
100104 // If comments are disabled via an option, delete comment lines from the content
101105 if !self . options . comments {
@@ -105,28 +109,22 @@ impl Input {
105109 . swap_greed ( true )
106110 . build ( )
107111 . unwrap ( ) ;
108- document = multi_comments
109- . replace_all ( & document, "" )
110- . to_string ( ) ;
112+ document = multi_comments. replace_all ( & document, "" ) . to_string ( ) ;
111113
112114 // Delete single-line comments
113115 let single_comments: Regex = RegexBuilder :: new ( r"^//.*\n" )
114116 . multi_line ( true )
115117 . swap_greed ( true )
116118 . build ( )
117119 . unwrap ( ) ;
118- document = single_comments
119- . replace_all ( & document, "" )
120- . to_string ( ) ;
120+ document = single_comments. replace_all ( & document, "" ) . to_string ( ) ;
121121
122122 // Delete leading white space left over by the deleted comments
123123 let leading_whitespace: Regex = RegexBuilder :: new ( r"^[\s\n]*" )
124124 . multi_line ( true )
125125 . build ( )
126126 . unwrap ( ) ;
127- document = leading_whitespace
128- . replace ( & document, "" )
129- . to_string ( ) ;
127+ document = leading_whitespace. replace ( & document, "" ) . to_string ( ) ;
130128 }
131129
132130 // Remove excess blank lines that might have been left by the verious
0 commit comments