Skip to content

Commit 0db8ca6

Browse files
committed
nit: rename module_ -> module
1 parent 6372a6d commit 0db8ca6

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

src/librustc_resolve/lib.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,9 +1228,9 @@ impl<'a> Resolver<'a> {
12281228
}
12291229
}
12301230

1231-
/// Resolves the given module path from the given root `module_`.
1231+
/// Resolves the given module path from the given root `search_module`.
12321232
fn resolve_module_path_from_root(&mut self,
1233-
module_: Module<'a>,
1233+
mut search_module: Module<'a>,
12341234
module_path: &[Name],
12351235
index: usize,
12361236
span: Span)
@@ -1247,7 +1247,6 @@ impl<'a> Resolver<'a> {
12471247
}
12481248
}
12491249

1250-
let mut search_module = module_;
12511250
let mut index = index;
12521251
let module_path_len = module_path.len();
12531252

@@ -1444,31 +1443,30 @@ impl<'a> Resolver<'a> {
14441443
}
14451444

14461445
/// Returns the nearest normal module parent of the given module.
1447-
fn get_nearest_normal_module_parent(&self, module_: Module<'a>) -> Option<Module<'a>> {
1448-
let mut module_ = module_;
1446+
fn get_nearest_normal_module_parent(&self, mut module: Module<'a>) -> Option<Module<'a>> {
14491447
loop {
1450-
match module_.parent_link {
1448+
match module.parent_link {
14511449
NoParentLink => return None,
14521450
ModuleParentLink(new_module, _) |
14531451
BlockParentLink(new_module, _) => {
14541452
let new_module = new_module;
14551453
if new_module.is_normal() {
14561454
return Some(new_module);
14571455
}
1458-
module_ = new_module;
1456+
module = new_module;
14591457
}
14601458
}
14611459
}
14621460
}
14631461

14641462
/// Returns the nearest normal module parent of the given module, or the
14651463
/// module itself if it is a normal module.
1466-
fn get_nearest_normal_module_parent_or_self(&self, module_: Module<'a>) -> Module<'a> {
1467-
if module_.is_normal() {
1468-
return module_;
1464+
fn get_nearest_normal_module_parent_or_self(&self, module: Module<'a>) -> Module<'a> {
1465+
if module.is_normal() {
1466+
return module;
14691467
}
1470-
match self.get_nearest_normal_module_parent(module_) {
1471-
None => module_,
1468+
match self.get_nearest_normal_module_parent(module) {
1469+
None => module,
14721470
Some(new_module) => new_module,
14731471
}
14741472
}
@@ -1485,8 +1483,8 @@ impl<'a> Resolver<'a> {
14851483
"super" => 0,
14861484
_ => return Success(NoPrefixFound),
14871485
};
1488-
let module_ = self.current_module;
1489-
let mut containing_module = self.get_nearest_normal_module_parent_or_self(module_);
1486+
let mut containing_module =
1487+
self.get_nearest_normal_module_parent_or_self(self.current_module);
14901488

14911489
// Now loop through all the `super`s we find.
14921490
while i < module_path.len() && "super" == module_path[i].as_str() {

src/librustc_resolve/resolve_imports.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
490490
let value_result = self.resolve_name_in_module(target_module, source, ValueNS, false, true);
491491
let type_result = self.resolve_name_in_module(target_module, source, TypeNS, false, true);
492492

493-
let module_ = self.current_module;
493+
let module = self.current_module;
494494
let mut privacy_error = true;
495495
for &(ns, result, determined) in &[(ValueNS, &value_result, value_determined),
496496
(TypeNS, &type_result, type_determined)] {
497497
match *result {
498498
Failed(..) if !determined.get() => {
499499
determined.set(true);
500-
self.update_resolution(module_, target, ns, |_, resolution| {
500+
self.update_resolution(module, target, ns, |_, resolution| {
501501
resolution.single_imports.directive_failed()
502502
});
503503
}
@@ -506,17 +506,17 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
506506
span_err!(self.session, directive.span, E0253, "{}", &msg);
507507
// Do not import this illegal binding. Import a dummy binding and pretend
508508
// everything is fine
509-
self.import_dummy_binding(module_, directive);
509+
self.import_dummy_binding(module, directive);
510510
return Success(());
511511
}
512512
Success(binding) if !self.is_accessible(binding.vis) => {}
513513
Success(binding) if !determined.get() => {
514514
determined.set(true);
515515
let imported_binding = directive.import(binding);
516-
let conflict = self.try_define(module_, target, ns, imported_binding);
516+
let conflict = self.try_define(module, target, ns, imported_binding);
517517
if let Err(old_binding) = conflict {
518518
let binding = &directive.import(binding);
519-
self.report_conflict(module_, target, ns, binding, old_binding);
519+
self.report_conflict(module, target, ns, binding, old_binding);
520520
}
521521
privacy_error = false;
522522
}
@@ -556,7 +556,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
556556
for &(ns, result) in &[(ValueNS, &value_result), (TypeNS, &type_result)] {
557557
let binding = match *result { Success(binding) => binding, _ => continue };
558558
self.privacy_errors.push(PrivacyError(directive.span, source, binding));
559-
let _ = self.try_define(module_, target, ns, directive.import(binding));
559+
let _ = self.try_define(module, target, ns, directive.import(binding));
560560
}
561561
}
562562

@@ -615,8 +615,8 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
615615
self.session.span_err(directive.span, "items in traits are not importable.");
616616
}
617617

618-
let module_ = self.current_module;
619-
if module_.def_id() == target_module.def_id() {
618+
let module = self.current_module;
619+
if module.def_id() == target_module.def_id() {
620620
// This means we are trying to glob import a module into itself, and it is a no-go
621621
let msg = "Cannot glob-import a module into itself.".into();
622622
return Failed(Some((directive.span, msg)));
@@ -629,7 +629,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
629629
}
630630

631631
// Add to target_module's glob_importers
632-
target_module.glob_importers.borrow_mut().push((module_, directive));
632+
target_module.glob_importers.borrow_mut().push((module, directive));
633633

634634
// Ensure that `resolutions` isn't borrowed during `try_define`,
635635
// since it might get updated via a glob cycle.
@@ -638,7 +638,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
638638
}).collect::<Vec<_>>();
639639
for ((name, ns), binding) in bindings {
640640
if binding.is_importable() && binding.is_pseudo_public() {
641-
let _ = self.try_define(module_, name, ns, directive.import(binding));
641+
let _ = self.try_define(module, name, ns, directive.import(binding));
642642
}
643643
}
644644

0 commit comments

Comments
 (0)