@@ -44,16 +44,7 @@ impl Parser {
4444 return Ok ( HashMap :: new ( ) ) ;
4545 }
4646
47- let codeowners_entries: Vec < ( String , String ) > =
48- build_codeowners_lines_in_priority ( self . codeowners_file_path . to_string_lossy ( ) . into_owned ( ) )
49- . iter ( )
50- . map ( |line| {
51- line. split_once ( ' ' )
52- . map ( |( glob, team_name) | ( glob. to_string ( ) , team_name. to_string ( ) ) )
53- . ok_or_else ( || IoError :: new ( std:: io:: ErrorKind :: InvalidInput , "Invalid line" ) )
54- } )
55- . collect :: < Result < _ , IoError > > ( )
56- . map_err ( |e| Box :: new ( e) as Box < dyn Error > ) ?;
47+ let codeowners_entries = parse_codeowners_entries ( self . codeowners_file_path . to_string_lossy ( ) . into_owned ( ) ) ;
5748
5849 let teams_by_name = teams_by_github_team_name ( self . absolute_team_files_globs ( ) ) ;
5950
@@ -111,7 +102,6 @@ fn teams_by_github_team_name(team_file_glob: Vec<String>) -> HashMap<String, Tea
111102 teams
112103}
113104
114- #[ memoize]
115105fn build_codeowners_lines_in_priority ( codeowners_file_path : String ) -> Vec < String > {
116106 let codeowners_file = match fs:: read_to_string ( codeowners_file_path) {
117107 Ok ( codeowners_file) => codeowners_file,
@@ -124,6 +114,16 @@ fn build_codeowners_lines_in_priority(codeowners_file_path: String) -> Vec<Strin
124114 stripped_lines_by_priority ( & codeowners_file)
125115}
126116
117+ fn parse_codeowners_entries ( codeowners_file_path : String ) -> Vec < ( String , String ) > {
118+ build_codeowners_lines_in_priority ( codeowners_file_path)
119+ . iter ( )
120+ . filter_map ( |line| {
121+ line. split_once ( ' ' )
122+ . map ( |( glob, team_name) | ( glob. to_string ( ) , team_name. to_string ( ) ) )
123+ } )
124+ . collect ( )
125+ }
126+
127127#[ derive( Debug , Clone , PartialEq , Eq ) ]
128128struct Section {
129129 heading : String ,
0 commit comments