From cdcb55e3b8f364a94afe2dd9073799adbcf283f5 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 29 Oct 2017 13:45:55 -0700 Subject: [PATCH] PLIGenerators can be authoritative, not the instances themselves --- src/main.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index ea4163f..10eeb96 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,23 +41,17 @@ extern { } type PLIGenerator = Box Box + Send + Sync>; fn main() { - let languages: Vec> = - vec![ - Box::new(schala_lang::Schala::new()), - Box::new(maaru_lang::Maaru::new()), - Box::new(robo_lang::Robo::new()), - ]; - let generators: Vec = vec![ Box::new(|| { let x: Box = Box::new(schala_lang::Schala::new()); x }), Box::new(|| { let x: Box = Box::new(maaru_lang::Maaru::new()); x }), Box::new(|| { let x: Box = Box::new(robo_lang::Robo::new()); x }), ]; - schala_main(languages, generators); + schala_main(generators); } -fn schala_main(languages: Vec>, generators: Vec) { +fn schala_main(generators: Vec) { + let languages: Vec> = generators.iter().map(|x| x()).collect(); let option_matches = program_options().parse(std::env::args()).unwrap_or_else(|e| { println!("{:?}", e);