]> git.lizzy.rs Git - rust.git/commitdiff
Remove unneeded borrows and slices
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Fri, 29 Jan 2016 23:34:58 +0000 (23:34 +0000)
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Wed, 3 Feb 2016 23:40:46 +0000 (23:40 +0000)
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/resolve_imports.rs

index e84525ca296cedc0f6a8fd95ccf8ebfe3d31030e..6bc73194aa98b5cc220f509dcd44bd7143fc5fa3 100644 (file)
@@ -297,7 +297,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent: Module<'b>) -> M
                     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 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent: Module<'b>) -> M
                 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 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent: Module<'b>) -> M
                     };
 
                     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);
                 }
index d2e6273790dd1d2824cce06e5ca05522d1ca31d7..64973bd791634f11f92773320bf05b39296b1660 100644 (file)
@@ -1262,7 +1262,7 @@ fn search_parent_externals<'a>(needle: Name, module: Module<'a>) -> Option<Modul
                     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 @@ fn resolve_name_in_module(&mut self,
                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 @@ fn report_unresolved_imports(&mut self, module_: Module<'a>) {
         }
 
         // 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 @@ fn resolve_crate_relative_path(&mut self,
         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 @@ fn resolve_crate_relative_path(&mut self,
                     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)
                     }
                 };
index 577f346fbe5ad498c055ef89defff645ceacd788..3d2300e44c46893484a9f0ef897856089a26f4da 100644 (file)
@@ -257,7 +257,7 @@ fn resolve_imports_for_module_subtree(&mut self,
         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 @@ fn resolve_import_for_module(&mut self,
                 // 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 @@ fn resolve_single_import(&mut self,
 
         // 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 @@ fn resolve_single_import(&mut self,
         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 @@ fn resolve_glob_import(&mut self,
         }
 
         // 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_,