add performance suggestion

This commit is contained in:
Dan Miller 2023-05-16 18:59:26 -05:00
parent 1a9c89d5c3
commit ef86e0c3ab

View File

@ -9,7 +9,8 @@ enum FnItem {
} }
/// build a Vec of all Items, unless the Item is a Item::Mod, then append the Item contents of the vect /// build a Vec of all Items, unless the Item is a Item::Mod, then append the Item contents of the vect
/// Do this recursively /// Do this recursively.
/// This is not memory-efficient, would work better with an iterator, but does not seem performance critical.
fn depth_first_module_walk<'a>(ast: &'a Vec<Item>) -> Vec<&'a syn::Item>{ fn depth_first_module_walk<'a>(ast: &'a Vec<Item>) -> Vec<&'a syn::Item>{
let mut unwrapped_items : Vec<&syn::Item> = vec![]; let mut unwrapped_items : Vec<&syn::Item> = vec![];
for item in ast { for item in ast {