@@ -219,11 +219,10 @@ pub fn compile(
219219 } else {
220220 None
221221 }
222- . map ( |res | {
222+ . inspect ( |_res | {
223223 if !( log_enabled ! ( Info ) ) {
224224 inc ( ) ;
225225 }
226- res
227226 } )
228227 } )
229228 . collect :: < Vec <
@@ -236,103 +235,100 @@ pub fn compile(
236235 ) > ,
237236 > > ( )
238237 . iter ( )
239- . for_each ( |result| match result {
240- Some ( ( module_name, result, interface_result, is_clean, is_compiled) ) => {
241- in_progress_modules. remove ( module_name) ;
238+ . for_each ( |result| if let Some ( ( module_name, result, interface_result, is_clean, is_compiled) ) = result {
239+ in_progress_modules. remove ( module_name) ;
242240
243- if * is_compiled {
244- num_compiled_modules += 1 ;
245- }
241+ if * is_compiled {
242+ num_compiled_modules += 1 ;
243+ }
246244
247- files_current_loop_count += 1 ;
248- compiled_modules. insert ( module_name. to_string ( ) ) ;
245+ files_current_loop_count += 1 ;
246+ compiled_modules. insert ( module_name. to_string ( ) ) ;
249247
250- if * is_clean {
251- // actually add it to a list of clean modules
252- clean_modules. insert ( module_name. to_string ( ) ) ;
253- }
248+ if * is_clean {
249+ // actually add it to a list of clean modules
250+ clean_modules. insert ( module_name. to_string ( ) ) ;
251+ }
254252
255- let module_dependents = build_state. get_module ( module_name) . unwrap ( ) . dependents . clone ( ) ;
253+ let module_dependents = build_state. get_module ( module_name) . unwrap ( ) . dependents . clone ( ) ;
256254
257- // if not clean -- compile modules that depend on this module
258- for dep in module_dependents. iter ( ) {
255+ // if not clean -- compile modules that depend on this module
256+ for dep in module_dependents. iter ( ) {
257+ // mark the reverse dep as dirty when the source is not clean
258+ if !* is_clean {
259+ let dep_module = build_state. modules . get_mut ( dep) . unwrap ( ) ;
259260 // mark the reverse dep as dirty when the source is not clean
260- if !* is_clean {
261- let dep_module = build_state. modules . get_mut ( dep) . unwrap ( ) ;
262- // mark the reverse dep as dirty when the source is not clean
263- dep_module. compile_dirty = true ;
264- }
265- if !compiled_modules. contains ( dep) {
266- in_progress_modules. insert ( dep. to_string ( ) ) ;
267- }
261+ dep_module. compile_dirty = true ;
268262 }
263+ if !compiled_modules. contains ( dep) {
264+ in_progress_modules. insert ( dep. to_string ( ) ) ;
265+ }
266+ }
269267
270- let module = build_state. modules . get_mut ( module_name) . unwrap ( ) ;
271- let package = build_state
272- . packages
273- . get ( & module. package_name )
274- . expect ( "Package not found" ) ;
275- match module. source_type {
276- SourceType :: MlMap ( ref mut mlmap) => {
277- module. compile_dirty = false ;
278- mlmap. parse_dirty = false ;
279- }
280- SourceType :: SourceFile ( ref mut source_file) => {
281- match result {
282- Ok ( Some ( err) ) => {
283- source_file. implementation . compile_state = CompileState :: Warning ;
284- logs:: append ( package, err) ;
285- compile_warnings. push_str ( err) ;
286- }
287- Ok ( None ) => {
288- source_file. implementation . compile_state = CompileState :: Success ;
289- }
290- Err ( err) => {
291- source_file. implementation . compile_state = CompileState :: Error ;
292- logs:: append ( package, err) ;
293- compile_errors. push_str ( err) ;
294- }
295- } ;
296- match interface_result {
297- Some ( Ok ( Some ( err) ) ) => {
298- source_file. interface . as_mut ( ) . unwrap ( ) . compile_state =
299- CompileState :: Warning ;
300- logs:: append ( package, err) ;
301- compile_warnings. push_str ( err) ;
302- }
303- Some ( Ok ( None ) ) => {
304- if let Some ( interface) = source_file. interface . as_mut ( ) {
305- interface. compile_state = CompileState :: Success ;
306- }
268+ let module = build_state. modules . get_mut ( module_name) . unwrap ( ) ;
269+ let package = build_state
270+ . packages
271+ . get ( & module. package_name )
272+ . expect ( "Package not found" ) ;
273+ match module. source_type {
274+ SourceType :: MlMap ( ref mut mlmap) => {
275+ module. compile_dirty = false ;
276+ mlmap. parse_dirty = false ;
277+ }
278+ SourceType :: SourceFile ( ref mut source_file) => {
279+ match result {
280+ Ok ( Some ( err) ) => {
281+ source_file. implementation . compile_state = CompileState :: Warning ;
282+ logs:: append ( package, err) ;
283+ compile_warnings. push_str ( err) ;
284+ }
285+ Ok ( None ) => {
286+ source_file. implementation . compile_state = CompileState :: Success ;
287+ }
288+ Err ( err) => {
289+ source_file. implementation . compile_state = CompileState :: Error ;
290+ logs:: append ( package, err) ;
291+ compile_errors. push_str ( err) ;
292+ }
293+ } ;
294+ match interface_result {
295+ Some ( Ok ( Some ( err) ) ) => {
296+ source_file. interface . as_mut ( ) . unwrap ( ) . compile_state =
297+ CompileState :: Warning ;
298+ logs:: append ( package, err) ;
299+ compile_warnings. push_str ( err) ;
300+ }
301+ Some ( Ok ( None ) ) => {
302+ if let Some ( interface) = source_file. interface . as_mut ( ) {
303+ interface. compile_state = CompileState :: Success ;
307304 }
305+ }
308306
309- Some ( Err ( err) ) => {
310- source_file. interface . as_mut ( ) . unwrap ( ) . compile_state =
311- CompileState :: Error ;
312- logs:: append ( package, err) ;
313- compile_errors. push_str ( err) ;
314- }
315- _ => ( ) ,
316- } ;
317- match ( result, interface_result) {
318- // successfull compilation
319- ( Ok ( None ) , Some ( Ok ( None ) ) ) | ( Ok ( None ) , None ) => {
320- module. compile_dirty = false ;
321- module. last_compiled_cmi = Some ( SystemTime :: now ( ) ) ;
322- module. last_compiled_cmt = Some ( SystemTime :: now ( ) ) ;
323- }
324- // some error or warning
325- ( Err ( _) , _)
326- | ( _, Some ( Err ( _) ) )
327- | ( Ok ( Some ( _) ) , _)
328- | ( _, Some ( Ok ( Some ( _) ) ) ) => {
329- module. compile_dirty = true ;
330- }
307+ Some ( Err ( err) ) => {
308+ source_file. interface . as_mut ( ) . unwrap ( ) . compile_state =
309+ CompileState :: Error ;
310+ logs:: append ( package, err) ;
311+ compile_errors. push_str ( err) ;
312+ }
313+ _ => ( ) ,
314+ } ;
315+ match ( result, interface_result) {
316+ // successfull compilation
317+ ( Ok ( None ) , Some ( Ok ( None ) ) ) | ( Ok ( None ) , None ) => {
318+ module. compile_dirty = false ;
319+ module. last_compiled_cmi = Some ( SystemTime :: now ( ) ) ;
320+ module. last_compiled_cmt = Some ( SystemTime :: now ( ) ) ;
321+ }
322+ // some error or warning
323+ ( Err ( _) , _)
324+ | ( _, Some ( Err ( _) ) )
325+ | ( Ok ( Some ( _) ) , _)
326+ | ( _, Some ( Ok ( Some ( _) ) ) ) => {
327+ module. compile_dirty = true ;
331328 }
332329 }
333330 }
334331 }
335- None => ( ) ,
336332 } ) ;
337333
338334 files_total_count += files_current_loop_count;
@@ -388,7 +384,7 @@ pub fn compiler_args(
388384 // .unwrap_or(&vec![])
389385 // .to_owned();
390386
391- let deps = vec ! [ normal_deps]
387+ let deps = [ normal_deps]
392388 . concat ( )
393389 . par_iter ( )
394390 . map ( |package_name| {
@@ -455,7 +451,7 @@ pub fn compiler_args(
455451 _ => vec ! [ ] ,
456452 } ;
457453
458- vec ! [ warn_number, warn_error] . concat ( )
454+ [ warn_number, warn_error] . concat ( )
459455 }
460456 } ;
461457
0 commit comments