@@ -75,10 +75,6 @@ pub fn walk_tree(
7575 files. append ( & mut package_files) ;
7676 }
7777
78- for mutant in & mut mutants {
79- mutant. name = mutant. name ( true ) ;
80- }
81-
8278 progress. finish ( ) ;
8379 Ok ( Discovered { mutants, files } )
8480}
@@ -322,16 +318,16 @@ impl DiscoveryVisitor<'_> {
322318
323319 /// Record that we generated some mutants.
324320 fn collect_mutant ( & mut self , span : Span , replacement : & TokenStream , genre : Genre ) {
325- self . mutants . push ( Mutant {
326- name : String :: new ( ) ,
327- source_file : self . source_file . clone ( ) ,
328- function : self . fn_stack . last ( ) . cloned ( ) ,
321+ let mutant = Mutant :: new_discovered (
322+ self . source_file . clone ( ) ,
323+ self . fn_stack . last ( ) . cloned ( ) ,
329324 span,
330- short_replaced : None ,
331- replacement : replacement . to_pretty_string ( ) ,
325+ None ,
326+ replacement. to_pretty_string ( ) ,
332327 genre,
333- target : None ,
334- } ) ;
328+ None ,
329+ ) ;
330+ self . mutants . push ( mutant) ;
335331 }
336332
337333 fn collect_fn_mutants ( & mut self , sig : & Signature , block : & Block ) {
@@ -661,16 +657,15 @@ impl<'ast> Visit<'ast> for DiscoveryVisitor<'_> {
661657 continue ;
662658 }
663659 let short_replaced = Some ( arm. pat . to_pretty_string ( ) ) ;
664- let mutant = Mutant {
665- name : String :: new ( ) ,
666- source_file : self . source_file . clone ( ) ,
667- function : self . fn_stack . last ( ) . cloned ( ) ,
668- span : arm. span ( ) . into ( ) ,
660+ let mutant = Mutant :: new_discovered (
661+ self . source_file . clone ( ) ,
662+ self . fn_stack . last ( ) . cloned ( ) ,
663+ arm. span ( ) . into ( ) ,
669664 short_replaced,
670- replacement : String :: new ( ) ,
671- genre : Genre :: MatchArm ,
672- target : None ,
673- } ;
665+ String :: new ( ) ,
666+ Genre :: MatchArm ,
667+ None ,
668+ ) ;
674669 self . mutants . push ( mutant) ;
675670 }
676671 } else {
@@ -728,19 +723,18 @@ impl<'ast> Visit<'ast> for DiscoveryVisitor<'_> {
728723 // No comma, just the field
729724 field. span ( ) . into ( )
730725 } ;
731- let mutant = Mutant {
732- name : String :: new ( ) ,
733- source_file : self . source_file . clone ( ) ,
734- function : self . fn_stack . last ( ) . cloned ( ) ,
726+ let mutant = Mutant :: new_discovered (
727+ self . source_file . clone ( ) ,
728+ self . fn_stack . last ( ) . cloned ( ) ,
735729 span,
736- short_replaced : None ,
737- replacement : String :: new ( ) ,
738- genre : Genre :: StructField ,
739- target : Some ( MutationTarget :: StructLiteralField {
730+ None ,
731+ String :: new ( ) ,
732+ Genre :: StructField ,
733+ Some ( MutationTarget :: StructLiteralField {
740734 field_name : field_name_str,
741735 struct_name : struct_name. clone ( ) ,
742736 } ) ,
743- } ;
737+ ) ;
744738 self . mutants . push ( mutant) ;
745739 }
746740 }
0 commit comments