@@ -476,7 +476,7 @@ impl Rule for NewCap {
476476 || is_cap_allowed_expression (
477477 short_name,
478478 name,
479- & self . new_is_cap_exceptions ,
479+ self . new_is_cap_exceptions . iter ( ) ,
480480 self . new_is_cap_exception_pattern . as_ref ( ) ,
481481 )
482482 || ( !self . properties && short_name != name) ;
@@ -498,14 +498,12 @@ impl Rule for NewCap {
498498
499499 let capitalization = & get_cap ( short_name) ;
500500
501- let mut caps_is_new_exceptions = self . cap_is_new_exceptions . clone ( ) ;
502- caps_is_new_exceptions. append ( & mut caps_allowed_vec ( ) ) ;
503-
501+ let caps_allowed = caps_allowed_vec ( ) ;
504502 let allowed = * capitalization != GetCapResult :: Upper
505503 || is_cap_allowed_expression (
506504 short_name,
507505 name,
508- & caps_is_new_exceptions ,
506+ self . cap_is_new_exceptions . iter ( ) . chain ( caps_allowed . iter ( ) ) ,
509507 self . cap_is_new_exception_pattern . as_ref ( ) ,
510508 )
511509 || ( !self . properties && short_name != name) ;
@@ -628,14 +626,16 @@ fn extract_name_from_expression(expression: &Expression) -> Option<CompactStr> {
628626 }
629627}
630628
631- fn is_cap_allowed_expression (
629+ fn is_cap_allowed_expression < ' a > (
632630 short_name : & CompactStr ,
633631 name : & CompactStr ,
634- exceptions : & [ CompactStr ] ,
632+ exceptions : impl Iterator < Item = & ' a CompactStr > ,
635633 patterns : Option < & Regex > ,
636634) -> bool {
637- if exceptions. contains ( name) || exceptions. contains ( short_name) {
638- return true ;
635+ for exception in exceptions {
636+ if exception == name || exception == short_name {
637+ return true ;
638+ }
639639 }
640640
641641 if name == "Date.UTC" {
0 commit comments