mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Remove unneeded borrows and slices
This commit is contained in:
parent
9fc71b4506
commit
9c166cb671
@ -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
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
@ -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");
|
||||
@ -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() {
|
||||
@ -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)) {
|
||||
@ -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)
|
||||
}
|
||||
};
|
||||
|
@ -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 => {
|
||||
@ -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(|()| {
|
||||
@ -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 &&
|
||||
@ -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)));
|
||||
}
|
||||
|
||||
@ -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_,
|
||||
|
Loading…
Reference in New Issue
Block a user