Avoid unnecessary work in finalize_resolutions_in
.
If `module.opt_def_id()` returns `None`, we can skip most of the work.
This commit is contained in:
parent
788ddedb0d
commit
0e475b5d5e
1 changed files with 22 additions and 22 deletions
|
@ -1090,6 +1090,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
// Since import resolution is finished, globs will not define any more names.
|
||||
*module.globs.borrow_mut() = Vec::new();
|
||||
|
||||
if let Some(def_id) = module.opt_def_id() {
|
||||
let mut reexports = Vec::new();
|
||||
|
||||
module.for_each_child(self.r, |_, ident, _, binding| {
|
||||
|
@ -1114,7 +1115,6 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
});
|
||||
|
||||
if !reexports.is_empty() {
|
||||
if let Some(def_id) = module.opt_def_id() {
|
||||
// Call to `expect_local` should be fine because current
|
||||
// code is only called for local modules.
|
||||
self.r.reexport_map.insert(def_id.expect_local(), reexports);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue