@@ -69,16 +69,18 @@ impl PackageMapper {
6969 let team_by_name = self . project . teams_by_name . clone ( ) ;
7070
7171 for package in self . project . packages . iter ( ) . filter ( |package| & package. package_type == package_type) {
72- let package_root = package. package_root ( ) . to_string_lossy ( ) ;
73- let team = team_by_name. get ( & package. owner ) ;
74-
75- if let Some ( team) = team {
76- entries. push ( Entry {
77- path : format ! ( "{}/**/**" , package_root) ,
78- github_team : team. github_team . to_owned ( ) ,
79- team_name : team. name . to_owned ( ) ,
80- disabled : team. avoid_ownership ,
81- } ) ;
72+ if let Some ( package_root) = package. package_root ( ) {
73+ let package_root = package_root. to_string_lossy ( ) ;
74+ let team = team_by_name. get ( & package. owner ) ;
75+
76+ if let Some ( team) = team {
77+ entries. push ( Entry {
78+ path : format ! ( "{}/**/**" , package_root) ,
79+ github_team : team. github_team . to_owned ( ) ,
80+ team_name : team. name . to_owned ( ) ,
81+ disabled : team. avoid_ownership ,
82+ } ) ;
83+ }
8284 }
8385 }
8486
@@ -97,15 +99,17 @@ impl PackageMapper {
9799 let packages = remove_nested_packages ( & packages) ;
98100
99101 for package in packages {
100- let package_root = package. package_root ( ) . to_string_lossy ( ) ;
101- let team = team_by_name. get ( & package. owner ) ;
102-
103- if let Some ( team) = team {
104- owner_matchers. push ( OwnerMatcher :: new_glob (
105- format ! ( "{}/**/**" , package_root) ,
106- team. name . to_owned ( ) ,
107- Source :: Package ( package. path . to_string_lossy ( ) . to_string ( ) , format ! ( "{}/**/**" , package_root) ) ,
108- ) ) ;
102+ if let Some ( package_root) = package. package_root ( ) {
103+ let package_root = package_root. to_string_lossy ( ) ;
104+ let team = team_by_name. get ( & package. owner ) ;
105+
106+ if let Some ( team) = team {
107+ owner_matchers. push ( OwnerMatcher :: new_glob (
108+ format ! ( "{}/**/**" , package_root) ,
109+ team. name . to_owned ( ) ,
110+ Source :: Package ( package. path . to_string_lossy ( ) . to_string ( ) , format ! ( "{}/**/**" , package_root) ) ,
111+ ) ) ;
112+ }
109113 }
110114 }
111115
@@ -118,9 +122,10 @@ fn remove_nested_packages<'a>(packages: &'a [&'a Package]) -> Vec<&'a Package> {
118122
119123 for package in packages. iter ( ) . sorted_by_key ( |package| package. package_root ( ) ) {
120124 if let Some ( last_package) = top_level_packages. last ( ) {
121- let last_package_root = last_package. package_root ( ) ;
122- if !package. package_root ( ) . starts_with ( last_package_root) {
123- top_level_packages. push ( package) ;
125+ if let ( Some ( current_root) , Some ( last_root) ) = ( package. package_root ( ) , last_package. package_root ( ) ) {
126+ if !current_root. starts_with ( last_root) {
127+ top_level_packages. push ( package) ;
128+ }
124129 }
125130 } else {
126131 top_level_packages. push ( package) ;
0 commit comments