cleanup polonius liveness fact generation: mir visitor

have a variable instead of calling a method while constructing the extractor
This commit is contained in:
Remy Rakic 2019-12-09 18:57:12 +01:00
parent e6d8fbede2
commit cd9ec277c5

View File

@ -93,15 +93,15 @@ pub(super) fn populate_access_facts(
debug!("populate_var_liveness_facts()");
if let Some(facts) = typeck.borrowck_context.all_facts.as_mut() {
UseFactsExtractor {
let mut extractor = UseFactsExtractor {
var_defined: &mut facts.var_defined,
var_used: &mut facts.var_used,
var_drop_used: drop_used,
path_accessed_at: &mut facts.path_accessed_at,
location_table,
move_data,
}
.visit_body(body);
};
extractor.visit_body(body);
facts.var_drop_used.extend(drop_used.iter().map(|&(local, location)| {
(local, location_table.mid_index(location))