Skip to content

Commit 9c166cb

Browse files
committed
Remove unneeded borrows and slices
1 parent 9fc71b4 commit 9c166cb

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/librustc_resolve/build_reduced_graph.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
297297
let external_module = self.new_extern_crate_module(parent_link, def);
298298
self.define(parent, name, TypeNS, (external_module, sp));
299299

300-
self.build_reduced_graph_for_external_crate(&external_module);
300+
self.build_reduced_graph_for_external_crate(external_module);
301301
}
302302
parent
303303
}
@@ -353,7 +353,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
353353
for variant in &(*enum_definition).variants {
354354
let item_def_id = self.ast_map.local_def_id(item.id);
355355
self.build_reduced_graph_for_variant(variant, item_def_id,
356-
&module, variant_modifiers);
356+
module, variant_modifiers);
357357
}
358358
parent
359359
}
@@ -409,7 +409,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
409409
};
410410

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

414414
self.trait_item_map.insert((item.name, def_id), item_def_id);
415415
}

src/librustc_resolve/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
12621262
let segment_name = name.as_str();
12631263
let module_name = module_to_string(search_module);
12641264
let mut span = span;
1265-
let msg = if "???" == &module_name[..] {
1265+
let msg = if "???" == &module_name {
12661266
span.hi = span.lo + Pos::from_usize(segment_name.len());
12671267

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

15701570
// First, check the direct children of the module.
1571-
build_reduced_graph::populate_module_if_necessary(self, &module_);
1571+
build_reduced_graph::populate_module_if_necessary(self, module_);
15721572

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

16111611
// Descend into children and anonymous children.
1612-
build_reduced_graph::populate_module_if_necessary(self, &module_);
1612+
build_reduced_graph::populate_module_if_necessary(self, module_);
16131613

16141614
module_.for_each_local_child(|_, _, child_node| {
16151615
match child_node.module() {
@@ -2947,7 +2947,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
29472947
let containing_module;
29482948
let last_private;
29492949
match self.resolve_module_path_from_root(root_module,
2950-
&module_path[..],
2950+
&module_path,
29512951
0,
29522952
span,
29532953
LastMod(AllPublic)) {
@@ -2956,7 +2956,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
29562956
Some((span, msg)) => (span, msg),
29572957
None => {
29582958
let msg = format!("Use of undeclared module `::{}`",
2959-
names_to_string(&module_path[..]));
2959+
names_to_string(&module_path));
29602960
(span, msg)
29612961
}
29622962
};

src/librustc_resolve/resolve_imports.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
257257
errors.extend(self.resolve_imports_for_module(module_));
258258
self.resolver.current_module = orig_module;
259259

260-
build_reduced_graph::populate_module_if_necessary(self.resolver, &module_);
260+
build_reduced_graph::populate_module_if_necessary(self.resolver, module_);
261261
module_.for_each_local_child(|_, _, child_node| {
262262
match child_node.module() {
263263
None => {
@@ -345,14 +345,14 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
345345
// We found the module that the target is contained
346346
// within. Attempt to resolve the import within it.
347347
if let SingleImport(target, source) = import_directive.subclass {
348-
self.resolve_single_import(&module_,
348+
self.resolve_single_import(module_,
349349
containing_module,
350350
target,
351351
source,
352352
import_directive,
353353
lp)
354354
} else {
355-
self.resolve_glob_import(&module_, containing_module, import_directive, lp)
355+
self.resolve_glob_import(module_, containing_module, import_directive, lp)
356356
}
357357
})
358358
.and_then(|()| {
@@ -465,9 +465,9 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
465465

466466
// We need to resolve both namespaces for this to succeed.
467467
let (value_result, value_used_reexport) =
468-
self.resolve_name_in_module(&target_module, source, ValueNS, module_);
468+
self.resolve_name_in_module(target_module, source, ValueNS, module_);
469469
let (type_result, type_used_reexport) =
470-
self.resolve_name_in_module(&target_module, source, TypeNS, module_);
470+
self.resolve_name_in_module(target_module, source, TypeNS, module_);
471471

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

@@ -711,7 +711,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
711711
}
712712

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

716716
target_module.for_each_local_child(|name, ns, name_binding| {
717717
self.merge_import_resolution(module_,

0 commit comments

Comments
 (0)