Trivial refactoring

This commit is contained in:
Nick Cameron 2016-04-07 18:16:12 +12:00
parent c2aaad4e22
commit c99b73a767
2 changed files with 15 additions and 16 deletions

View File

@ -766,12 +766,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
"external crate/lib resolution",
|| LocalCrateReader::new(sess, cstore, &hir_map, name).read_crates());
let lang_items = time(time_passes, "language item collection", || {
sess.track_errors(|| {
middle::lang_items::collect_language_items(&sess, &hir_map)
})
})?;
let resolve::CrateMap {
def_map,
freevars,
@ -779,9 +773,15 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
trait_map,
glob_map,
} = time(time_passes,
"resolution",
"name resolution",
|| resolve::resolve_crate(sess, &hir_map, make_glob_map));
let lang_items = time(time_passes, "language item collection", || {
sess.track_errors(|| {
middle::lang_items::collect_language_items(&sess, &hir_map)
})
})?;
let mut analysis = ty::CrateAnalysis {
export_map: export_map,
access_levels: AccessLevels::default(),

View File

@ -813,9 +813,8 @@ impl<'a, 'b> LocalCrateReader<'a, 'b> {
fn process_crate(&self, c: &hir::Crate) {
for a in c.attrs.iter().filter(|m| m.name() == "link_args") {
match a.value_str() {
Some(ref linkarg) => self.cstore.add_used_link_args(&linkarg),
None => { /* fallthrough */ }
if let Some(ref linkarg) = a.value_str() {
self.cstore.add_used_link_args(&linkarg);
}
}
}
@ -830,12 +829,12 @@ impl<'a, 'b> LocalCrateReader<'a, 'b> {
match self.creader.extract_crate_info_hir(i) {
Some(info) => {
let (cnum, _, _) = self.creader.resolve_crate(&None,
&info.ident,
&info.name,
None,
i.span,
PathKind::Crate,
true);
&info.ident,
&info.name,
None,
i.span,
PathKind::Crate,
true);
let def_id = self.ast_map.local_def_id(i.id);
let len = self.ast_map.def_path(def_id).data.len();