@@ -171,24 +171,24 @@ impl CosmeticFilterCacheBuilder {
171171 . chain ( rule. hostnames . unwrap_or_default ( ) )
172172 . chain ( rule. entities . unwrap_or_default ( ) ) ;
173173
174- tokens_to_insert. for_each ( |t| self . store_hostname_filter ( & t, kind. clone ( ) ) ) ;
174+ tokens_to_insert. for_each ( |t| self . store_hostname_filter ( & t, & kind) ) ;
175175
176176 let tokens_to_insert_negated = std:: iter:: empty ( )
177177 . chain ( rule. not_hostnames . unwrap_or_default ( ) )
178178 . chain ( rule. not_entities . unwrap_or_default ( ) ) ;
179179
180180 let negated = kind. negated ( ) ;
181181
182- tokens_to_insert_negated. for_each ( |t| self . store_hostname_filter ( & t, negated. clone ( ) ) ) ;
182+ tokens_to_insert_negated. for_each ( |t| self . store_hostname_filter ( & t, & negated) ) ;
183183 }
184184
185- fn store_hostname_filter ( & mut self , token : & Hash , kind : SpecificFilterType ) {
185+ fn store_hostname_filter ( & mut self , token : & Hash , kind : & SpecificFilterType ) {
186186 use SpecificFilterType :: * ;
187187
188188 match kind {
189189 // Handle hide and inject_script at top level for better deduplication
190190 Hide ( s) => {
191- self . hostname_hide . insert ( * token, s) ;
191+ self . hostname_hide . insert ( * token, s. clone ( ) ) ;
192192 }
193193 InjectScript ( ( s, permission) ) => {
194194 let encoded_script = encode_script_with_permission ( s, permission) ;
@@ -197,19 +197,19 @@ impl CosmeticFilterCacheBuilder {
197197 // Handle remaining types through HostnameRule
198198 Unhide ( s) => {
199199 let entry = self . specific_rules . entry ( * token) . or_default ( ) ;
200- entry. unhide . push ( s) ;
200+ entry. unhide . push ( s. clone ( ) ) ;
201201 }
202202 UninjectScript ( ( s, _) ) => {
203203 let entry = self . specific_rules . entry ( * token) . or_default ( ) ;
204- entry. uninject_script . push ( s) ;
204+ entry. uninject_script . push ( s. clone ( ) ) ;
205205 }
206206 ProceduralOrAction ( s) => {
207207 let entry = self . specific_rules . entry ( * token) . or_default ( ) ;
208- entry. procedural_action . push ( s) ;
208+ entry. procedural_action . push ( s. clone ( ) ) ;
209209 }
210210 ProceduralOrActionException ( s) => {
211211 let entry = self . specific_rules . entry ( * token) . or_default ( ) ;
212- entry. procedural_action_exception . push ( s) ;
212+ entry. procedural_action_exception . push ( s. clone ( ) ) ;
213213 }
214214 }
215215 }
0 commit comments