5656 info ! (
5757 "Lowering {} in {:.2}s" ,
5858 format!( "{} ({:?})" , id. name, id. disambiguator) ,
59- time. as_secs( ) as f64 + time. subsec_nanos( ) as f64 / 1_000_000_000.0
59+ time. as_secs( ) as f64 + f64 :: from ( time. subsec_nanos( ) ) / 1_000_000_000.0
6060 ) ;
6161 info ! ( " defs: {}" , per_crate. defs. len( ) ) ;
6262 info ! ( " refs: {}" , per_crate. ref_spans. len( ) ) ;
6969 let rss = util:: get_resident ( ) . unwrap_or ( 0 ) as isize - rss as isize ;
7070 info ! (
7171 "Total lowering time: {:.2}s" ,
72- time. as_secs( ) as f64 + time. subsec_nanos( ) as f64 / 1_000_000_000.0
72+ time. as_secs( ) as f64 + f64 :: from ( time. subsec_nanos( ) ) / 1_000_000_000.0
7373 ) ;
7474 info ! ( "Diff in rss: {:.2}KB" , rss as f64 / 1000.0 ) ;
7575
@@ -80,7 +80,7 @@ fn lower_span(raw_span: &raw::SpanData, base_dir: &Path, path_rewrite: &Option<P
8080 let file_name = & raw_span. file_name ;
8181
8282 // Go from relative to absolute paths.
83- let file_name = if let & Some ( ref prefix) = path_rewrite {
83+ let file_name = if let Some ( ref prefix) = * path_rewrite {
8484 // Invariant: !file_name.is_absolute()
8585 // We don't assert this because better to have an incorrect span than to
8686 // panic.
@@ -221,7 +221,7 @@ impl<'a> CrateReader<'a> {
221221 }
222222 } else if let Some ( ref ref_id) = i. ref_id {
223223 // Import where we know the referred def.
224- let def_id = self . id_from_compiler_id ( ref_id) ;
224+ let def_id = self . id_from_compiler_id ( * ref_id) ;
225225 self . record_ref ( def_id, span, analysis, project_analysis) ;
226226 if let Some ( alias_span) = i. alias_span {
227227 let alias_span = lower_span ( & alias_span, & self . base_dir , & self . path_rewrite ) ;
@@ -322,13 +322,13 @@ impl<'a> CrateReader<'a> {
322322 continue ;
323323 }
324324
325- let id = self . id_from_compiler_id ( & d. id ) ;
325+ let id = self . id_from_compiler_id ( d. id ) ;
326326 if id != NULL && !analysis. defs . contains_key ( & id) {
327327 let file_name = span. file . clone ( ) ;
328328 analysis. defs_per_file . entry ( file_name) . or_insert_with ( || vec ! [ ] ) . push ( id) ;
329329 let decl_id = match d. decl_id {
330330 Some ( ref decl_id) => {
331- let def_id = self . id_from_compiler_id ( decl_id) ;
331+ let def_id = self . id_from_compiler_id ( * decl_id) ;
332332 analysis
333333 . ref_spans
334334 . entry ( def_id)
@@ -355,15 +355,15 @@ impl<'a> CrateReader<'a> {
355355 defs_to_index. push ( ( d. name . to_lowercase ( ) , id) ) ;
356356 }
357357
358- let parent = d. parent . map ( |id| self . id_from_compiler_id ( & id) ) ;
358+ let parent = d. parent . map ( |id| self . id_from_compiler_id ( id) ) ;
359359 if let Some ( parent) = parent {
360360 let children = analysis. children . entry ( parent) . or_insert_with ( HashSet :: new) ;
361361 children. insert ( id) ;
362362 }
363363 if !d. children . is_empty ( ) {
364364 let children_for_id = analysis. children . entry ( id) . or_insert_with ( HashSet :: new) ;
365365 children_for_id
366- . extend ( d. children . iter ( ) . map ( |id| self . id_from_compiler_id ( id) ) ) ;
366+ . extend ( d. children . iter ( ) . map ( |id| self . id_from_compiler_id ( * id) ) ) ;
367367 }
368368
369369 let def = Def {
@@ -402,7 +402,9 @@ impl<'a> CrateReader<'a> {
402402 // save-analysis often omits parent info.
403403 for ( parent, children) in & analysis. children {
404404 for c in children {
405- analysis. defs . get_mut ( c) . map ( |def| def. parent = Some ( * parent) ) ;
405+ if let Some ( def) = analysis. defs . get_mut ( c) {
406+ def. parent = Some ( * parent) ;
407+ }
406408 }
407409 }
408410 }
@@ -417,7 +419,7 @@ impl<'a> CrateReader<'a> {
417419 if r. span . file_name . to_str ( ) . map ( |s| s. ends_with ( '>' ) ) . unwrap_or ( true ) {
418420 continue ;
419421 }
420- let def_id = self . id_from_compiler_id ( & r. ref_id ) ;
422+ let def_id = self . id_from_compiler_id ( r. ref_id ) ;
421423 let span = lower_span ( & r. span , & self . base_dir , & self . path_rewrite ) ;
422424 self . record_ref ( def_id, span, analysis, project_analysis) ;
423425 }
@@ -434,8 +436,8 @@ impl<'a> CrateReader<'a> {
434436 RelationKind :: Impl { .. } => { }
435437 _ => continue ,
436438 }
437- let self_id = self . id_from_compiler_id ( & r. from ) ;
438- let trait_id = self . id_from_compiler_id ( & r. to ) ;
439+ let self_id = self . id_from_compiler_id ( r. from ) ;
440+ let trait_id = self . id_from_compiler_id ( r. to ) ;
439441 let span = lower_span ( & r. span , & self . base_dir , & self . path_rewrite ) ;
440442 if self_id != NULL {
441443 if let Some ( self_id) = abs_ref_id ( self_id, analysis, project_analysis) {
@@ -465,15 +467,15 @@ impl<'a> CrateReader<'a> {
465467
466468 // fn lower_sig_element(&self, raw_se: &raw::SigElement) -> SigElement {
467469 // SigElement {
468- // id: self.id_from_compiler_id(& raw_se.id),
470+ // id: self.id_from_compiler_id(raw_se.id),
469471 // start: raw_se.start,
470472 // end: raw_se.end,
471473 // }
472474 // }
473475
474476 /// Recreates resulting crate-local (`u32`, `u32`) id from compiler
475477 /// to a global `u64` `Id`, mapping from a local to global crate id.
476- fn id_from_compiler_id ( & self , id : & data:: Id ) -> Id {
478+ fn id_from_compiler_id ( & self , id : data:: Id ) -> Id {
477479 if id. krate == u32:: MAX || id. index == u32:: MAX {
478480 return NULL ;
479481 }
0 commit comments