@@ -322,8 +322,8 @@ impl IngotFileContext for Workspace {
322
322
path : & str ,
323
323
) -> Option < InputIngot > {
324
324
let ctx = get_containing_ingot ( & mut self . ingot_contexts , path) ;
325
- if ctx . is_some ( ) {
326
- Some ( ctx. unwrap ( ) . ingot_from_file_path ( db, path) . unwrap ( ) )
325
+ if let Some ( ctx ) = ctx {
326
+ Some ( ctx. ingot_from_file_path ( db, path) . unwrap ( ) )
327
327
} else {
328
328
self . standalone_ingot_context . ingot_from_file_path ( db, path)
329
329
}
@@ -335,8 +335,8 @@ impl IngotFileContext for Workspace {
335
335
path : & str ,
336
336
) -> Option < TopLevelMod > {
337
337
let ctx = get_containing_ingot ( & mut self . ingot_contexts , path) ;
338
- if ctx . is_some ( ) {
339
- Some ( ctx. unwrap ( ) . top_mod_from_file_path ( db, path) . unwrap ( ) )
338
+ if let Some ( ctx ) = ctx {
339
+ Some ( ctx. top_mod_from_file_path ( db, path) . unwrap ( ) )
340
340
} else {
341
341
self . standalone_ingot_context
342
342
. top_mod_from_file_path ( db, path)
@@ -451,10 +451,10 @@ mod tests {
451
451
let ingot = ctx. ingot_from_file_path ( & mut db, file_path) ;
452
452
assert ! ( ingot. is_some( ) ) ;
453
453
assert_eq ! (
454
- ingot. unwrap( ) . kind( & mut db) ,
454
+ ingot. unwrap( ) . kind( & db) ,
455
455
common:: input:: IngotKind :: StandAlone
456
456
) ;
457
- assert_eq ! ( ingot. unwrap( ) , file. unwrap( ) . ingot( & mut db) ) ;
457
+ assert_eq ! ( ingot. unwrap( ) , file. unwrap( ) . ingot( & db) ) ;
458
458
}
459
459
460
460
#[ test]
@@ -473,7 +473,7 @@ mod tests {
473
473
474
474
let _ingot_context_ingot = {
475
475
let ingot_context = workspace. ingot_context_from_config_path (
476
- & mut crate :: db:: LanguageServerDatabase :: default ( ) ,
476
+ & crate :: db:: LanguageServerDatabase :: default ( ) ,
477
477
config_path,
478
478
) ;
479
479
@@ -505,7 +505,7 @@ mod tests {
505
505
let mut db = crate :: db:: LanguageServerDatabase :: default ( ) ;
506
506
507
507
let ingot_context_ingot = {
508
- let ingot_context = workspace. ingot_context_from_config_path ( & mut db, config_path) ;
508
+ let ingot_context = workspace. ingot_context_from_config_path ( & db, config_path) ;
509
509
510
510
assert ! ( ingot_context. is_some( ) ) ;
511
511
ingot_context. map ( |ctx| ctx. ingot )
@@ -518,16 +518,13 @@ mod tests {
518
518
let ingot = workspace. ingot_from_file_path ( & mut db, file_path) ;
519
519
assert ! ( ingot. is_some( ) ) ;
520
520
521
- assert_eq ! ( file. map( |f| f. ingot( & mut db) ) . unwrap( ) , ingot. unwrap( ) ) ;
521
+ assert_eq ! ( file. map( |f| f. ingot( & db) ) . unwrap( ) , ingot. unwrap( ) ) ;
522
522
523
523
assert_eq ! (
524
- ingot_context_ingot. unwrap( ) . kind( & mut db) ,
525
- common:: input:: IngotKind :: Local
526
- ) ;
527
- assert_eq ! (
528
- ingot. unwrap( ) . kind( & mut db) ,
524
+ ingot_context_ingot. unwrap( ) . kind( & db) ,
529
525
common:: input:: IngotKind :: Local
530
526
) ;
527
+ assert_eq ! ( ingot. unwrap( ) . kind( & db) , common:: input:: IngotKind :: Local ) ;
531
528
assert_eq ! ( ingot_context_ingot. unwrap( ) , ingot. unwrap( ) ) ;
532
529
}
533
530
@@ -549,7 +546,7 @@ mod tests {
549
546
let fe_source_path = ingot_base_dir. join ( "src/main.fe" ) ;
550
547
let input = workspace. input_from_file_path ( & mut db, fe_source_path. to_str ( ) . unwrap ( ) ) ;
551
548
assert ! ( input. is_some( ) ) ;
552
- assert ! ( input. unwrap( ) . ingot( & mut db) . kind( & mut db) == common:: input:: IngotKind :: Local ) ;
549
+ assert ! ( input. unwrap( ) . ingot( & db) . kind( & db) == common:: input:: IngotKind :: Local ) ;
553
550
}
554
551
555
552
#[ test]
@@ -621,7 +618,7 @@ mod tests {
621
618
let contents = std:: fs:: read_to_string ( & file) . unwrap ( ) ;
622
619
let file = foo_context. input_from_file_path ( & mut db, & file) . unwrap ( ) ;
623
620
624
- assert ! ( * file. text( & mut db) == contents) ;
621
+ assert ! ( * file. text( & db) == contents) ;
625
622
}
626
623
}
627
624
@@ -640,15 +637,15 @@ mod tests {
640
637
. unwrap ( ) ;
641
638
642
639
assert_eq ! (
643
- dangling_file. ingot( & db) . kind( & mut db) ,
640
+ dangling_file. ingot( & db) . kind( & db) ,
644
641
common:: input:: IngotKind :: StandAlone
645
642
) ;
646
643
647
644
// TODO: make it easier to go both ways between an ingot root path and its config path
648
645
let ingot_paths = workspace
649
646
. ingot_contexts
650
647
. values ( )
651
- . map ( |ctx| format ! ( "{}{}" , ctx. ingot. path( & mut db) , FE_CONFIG_SUFFIX ) )
648
+ . map ( |ctx| format ! ( "{}{}" , ctx. ingot. path( & db) , FE_CONFIG_SUFFIX ) )
652
649
. collect :: < Vec < String > > ( ) ;
653
650
654
651
for ingot_path in ingot_paths {
@@ -661,7 +658,7 @@ mod tests {
661
658
. unwrap ( ) ;
662
659
663
660
assert_eq ! (
664
- non_dangling_input. ingot( & db) . kind( & mut db) ,
661
+ non_dangling_input. ingot( & db) . kind( & db) ,
665
662
common:: input:: IngotKind :: Local
666
663
) ;
667
664
}
0 commit comments