Skip to content

Commit

Permalink
Use function wrapper to annotate lifetimes on closures.
Browse files Browse the repository at this point in the history
See discussion rust-lang/rust#58052
  • Loading branch information
djg committed Aug 29, 2020
1 parent e00a263 commit 6308ddc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fluent-fallback/tests/l10nregistry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ fn localization_format_sync() {

reg.register_sources(vec![main_fs]).unwrap();

let generate_messages = |res_ids: &[PathBuf]| {
fn annotate<'a, T: 'a, U: 'a, F>(f: F) -> F where F: Fn(T) -> U {
f
}

let generate_messages = annotate(|res_ids: &[PathBuf]| {
let locales = get_app_locales();
reg.generate_bundles_sync(locales, res_ids)
};
reg.generate_bundles_sync(locales, res_ids)
});

let loc = Localization::new(resource_ids.clone(), Some(generate_messages));

Expand Down

0 comments on commit 6308ddc

Please sign in to comment.