@@ -156,24 +156,21 @@ impl Engines {
156
156
157
157
/// Returns iterator over template (name, engine_extension).
158
158
pub ( crate ) fn templates ( & self ) -> impl Iterator < Item = ( & str , & ' static str ) > {
159
- #[ cfg( all( feature = "tera" , feature = "handlebars" ) ) ] {
160
- self . tera . get_template_names ( )
161
- . map ( |name| ( name, Tera :: EXT ) )
162
- . chain ( self . handlebars . get_templates ( ) . keys ( )
163
- . map ( |name| ( name. as_str ( ) , Handlebars :: EXT ) ) )
164
- }
159
+ #[ cfg( feature = "tera" ) ]
160
+ let tera = self . tera . get_template_names ( ) . map ( |name| ( name, Tera :: EXT ) ) ;
165
161
166
- #[ cfg( all ( feature = "tera" , not ( feature = " handlebars") ) ) ] {
167
- self . tera . get_template_names ( ) . map ( |name| ( name , Tera :: EXT ) )
168
- }
162
+ #[ cfg( feature = "handlebars" ) ]
163
+ let handlebars = self . handlebars . get_templates ( ) . keys ( )
164
+ . map ( |name| ( name . as_str ( ) , Handlebars :: EXT ) ) ;
169
165
170
- #[ cfg( all( feature = "handlebars" , not( feature = "tera" ) ) ) ] {
171
- self . handlebars . get_templates ( ) . keys ( )
172
- . map ( |name| ( name. as_str ( ) , Handlebars :: EXT ) )
173
- }
166
+ #[ cfg( feature = "minijinja" ) ]
167
+ let minijinja = self . minijinja . templates ( )
168
+ . map ( |( name, _) | ( name, Environment :: EXT ) ) ;
174
169
175
- #[ cfg( not( any( feature = "tera" , feature = "handlebars" ) ) ) ] {
176
- None . into_iter ( )
177
- }
170
+ #[ cfg( not( feature = "tera" ) ) ] let tera = std:: iter:: empty ( ) ;
171
+ #[ cfg( not( feature = "handlebars" ) ) ] let handlebars = std:: iter:: empty ( ) ;
172
+ #[ cfg( not( feature = "minijinja" ) ) ] let minijinja = std:: iter:: empty ( ) ;
173
+
174
+ tera. chain ( handlebars) . chain ( minijinja)
178
175
}
179
176
}
0 commit comments