@@ -11,6 +11,7 @@ use fluent_fallback::{
1111 types:: { L10nKey , ResourceId } ,
1212 Localization , LocalizationError ,
1313} ;
14+ use rustc_hash:: FxHashSet ;
1415use std:: cell:: RefCell ;
1516use std:: rc:: Rc ;
1617use unic_langid:: { langid, LanguageIdentifier } ;
@@ -55,7 +56,7 @@ impl LocalesProvider for Locales {
5556// lack of GATs, these have to own members instead of taking slices.
5657struct BundleIter {
5758 locales : <Vec < LanguageIdentifier > as IntoIterator >:: IntoIter ,
58- res_ids : Vec < ResourceId > ,
59+ res_ids : FxHashSet < ResourceId > ,
5960}
6061
6162impl Iterator for BundleIter {
@@ -132,11 +133,19 @@ impl BundleGenerator for ResourceManager {
132133 type Iter = BundleIter ;
133134 type Stream = BundleIter ;
134135
135- fn bundles_iter ( & self , locales : Self :: LocalesIter , res_ids : Vec < ResourceId > ) -> Self :: Iter {
136+ fn bundles_iter (
137+ & self ,
138+ locales : Self :: LocalesIter ,
139+ res_ids : FxHashSet < ResourceId > ,
140+ ) -> Self :: Iter {
136141 BundleIter { locales, res_ids }
137142 }
138143
139- fn bundles_stream ( & self , locales : Self :: LocalesIter , res_ids : Vec < ResourceId > ) -> Self :: Stream {
144+ fn bundles_stream (
145+ & self ,
146+ locales : Self :: LocalesIter ,
147+ res_ids : FxHashSet < ResourceId > ,
148+ ) -> Self :: Stream {
140149 BundleIter { locales, res_ids }
141150 }
142151}
@@ -490,7 +499,6 @@ async fn localization_handle_state_changes_mid_async() {
490499}
491500
492501#[ test]
493- #[ should_panic]
494502fn localization_duplicate_resources ( ) {
495503 let resource_ids: Vec < ResourceId > =
496504 vec ! [ "test.ftl" . into( ) , "test2.ftl" . into( ) , "test2.ftl" . into( ) ] ;
0 commit comments