about summary refs log tree commit diff
path: root/src/librustc_save_analysis
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-07-26 17:11:10 +0200
committerljedrz <ljedrz@gmail.com>2018-07-29 18:53:22 +0200
commit59c8a279daf6912b99ba089ff6dafbfc3469831e (patch)
treeab821f37fca36aa9730bed95c0cad5fbf3e9eaa4 /src/librustc_save_analysis
parenta5c2d0fffaaf0b764c01bc4066e51ffd475ceae9 (diff)
downloadrust-59c8a279daf6912b99ba089ff6dafbfc3469831e.tar.gz
rust-59c8a279daf6912b99ba089ff6dafbfc3469831e.zip
Replace push loops with collect() and extend() where possible
Diffstat (limited to 'src/librustc_save_analysis')
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index ac7085a55cf..04a4bca4ffb 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -1318,14 +1318,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
                 };
 
                 // Make a comma-separated list of names of imported modules.
-                let mut names = vec![];
                 let glob_map = &self.save_ctxt.analysis.glob_map;
                 let glob_map = glob_map.as_ref().unwrap();
-                if glob_map.contains_key(&id) {
-                    for n in glob_map.get(&id).unwrap() {
-                        names.push(n.to_string());
-                    }
-                }
+                let names = if glob_map.contains_key(&id) {
+                    glob_map.get(&id).unwrap().iter().map(|n| n.to_string()).collect()
+                } else {
+                    Vec::new()
+                };
 
                 let sub_span = self.span.sub_span_of_token(use_tree.span,
                                                            token::BinOp(token::Star));