Skip to content

Commit

Permalink
Remove unneeded borrows and slices
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Feb 3, 2016
1 parent 9fc71b4 commit 9c166cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
let external_module = self.new_extern_crate_module(parent_link, def);
self.define(parent, name, TypeNS, (external_module, sp));

self.build_reduced_graph_for_external_crate(&external_module);
self.build_reduced_graph_for_external_crate(external_module);
}
parent
}
Expand Down Expand Up @@ -353,7 +353,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
for variant in &(*enum_definition).variants {
let item_def_id = self.ast_map.local_def_id(item.id);
self.build_reduced_graph_for_variant(variant, item_def_id,
&module, variant_modifiers);
module, variant_modifiers);
}
parent
}
Expand Down Expand Up @@ -409,7 +409,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
};

let modifiers = DefModifiers::PUBLIC; // NB: not DefModifiers::IMPORTABLE
self.define(&module_parent, item.name, ns, (def, item.span, modifiers));
self.define(module_parent, item.name, ns, (def, item.span, modifiers));

self.trait_item_map.insert((item.name, def_id), item_def_id);
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let segment_name = name.as_str();
let module_name = module_to_string(search_module);
let mut span = span;
let msg = if "???" == &module_name[..] {
let msg = if "???" == &module_name {
span.hi = span.lo + Pos::from_usize(segment_name.len());

match search_parent_externals(name, &self.current_module) {
Expand Down Expand Up @@ -1568,7 +1568,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
module_to_string(&*module_));

// First, check the direct children of the module.
build_reduced_graph::populate_module_if_necessary(self, &module_);
build_reduced_graph::populate_module_if_necessary(self, module_);

if let Some(binding) = module_.get_child(name, namespace) {
debug!("(resolving name in module) found node as child");
Expand Down Expand Up @@ -1609,7 +1609,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}

// Descend into children and anonymous children.
build_reduced_graph::populate_module_if_necessary(self, &module_);
build_reduced_graph::populate_module_if_necessary(self, module_);

module_.for_each_local_child(|_, _, child_node| {
match child_node.module() {
Expand Down Expand Up @@ -2947,7 +2947,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let containing_module;
let last_private;
match self.resolve_module_path_from_root(root_module,
&module_path[..],
&module_path,
0,
span,
LastMod(AllPublic)) {
Expand All @@ -2956,7 +2956,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
Some((span, msg)) => (span, msg),
None => {
let msg = format!("Use of undeclared module `::{}`",
names_to_string(&module_path[..]));
names_to_string(&module_path));
(span, msg)
}
};
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
errors.extend(self.resolve_imports_for_module(module_));
self.resolver.current_module = orig_module;

build_reduced_graph::populate_module_if_necessary(self.resolver, &module_);
build_reduced_graph::populate_module_if_necessary(self.resolver, module_);
module_.for_each_local_child(|_, _, child_node| {
match child_node.module() {
None => {
Expand Down Expand Up @@ -345,14 +345,14 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
// We found the module that the target is contained
// within. Attempt to resolve the import within it.
if let SingleImport(target, source) = import_directive.subclass {
self.resolve_single_import(&module_,
self.resolve_single_import(module_,
containing_module,
target,
source,
import_directive,
lp)
} else {
self.resolve_glob_import(&module_, containing_module, import_directive, lp)
self.resolve_glob_import(module_, containing_module, import_directive, lp)
}
})
.and_then(|()| {
Expand Down Expand Up @@ -465,9 +465,9 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {

// We need to resolve both namespaces for this to succeed.
let (value_result, value_used_reexport) =
self.resolve_name_in_module(&target_module, source, ValueNS, module_);
self.resolve_name_in_module(target_module, source, ValueNS, module_);
let (type_result, type_used_reexport) =
self.resolve_name_in_module(&target_module, source, TypeNS, module_);
self.resolve_name_in_module(target_module, source, TypeNS, module_);

match (&value_result, &type_result) {
(&Success((_, ref name_binding)), _) if !value_used_reexport &&
Expand Down Expand Up @@ -585,7 +585,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
if let (&Failed(_), &Failed(_)) = (&value_result, &type_result) {
let msg = format!("There is no `{}` in `{}`{}",
source,
module_to_string(&target_module), lev_suggestion);
module_to_string(target_module), lev_suggestion);
return Failed(Some((directive.span, msg)));
}

Expand Down Expand Up @@ -711,7 +711,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
}

// Add all children from the containing module.
build_reduced_graph::populate_module_if_necessary(self.resolver, &target_module);
build_reduced_graph::populate_module_if_necessary(self.resolver, target_module);

target_module.for_each_local_child(|name, ns, name_binding| {
self.merge_import_resolution(module_,
Expand Down

0 comments on commit 9c166cb

Please sign in to comment.