]> git.lizzy.rs Git - rust.git/commitdiff
Prefer &[T] to &Vec<T>
authortopecongiro <seuchida@gmail.com>
Thu, 26 Oct 2017 07:57:11 +0000 (16:57 +0900)
committertopecongiro <seuchida@gmail.com>
Mon, 6 Nov 2017 04:52:25 +0000 (13:52 +0900)
src/imports.rs

index a44206df0496b28de01d3a7bd2fe57e43c063f1b..faf0638f7d1326e9b9cae1d6cc3008643f4ace9b 100644 (file)
@@ -75,11 +75,11 @@ fn compare_path_list_items(a: &ast::PathListItem, b: &ast::PathListItem) -> Orde
 }
 
 fn compare_path_list_item_lists(
-    a_items: &Vec<ast::PathListItem>,
-    b_items: &Vec<ast::PathListItem>,
+    a_items: &[ast::PathListItem],
+    b_items: &[ast::PathListItem],
 ) -> Ordering {
-    let mut a = a_items.clone();
-    let mut b = b_items.clone();
+    let mut a = a_items.to_owned();
+    let mut b = b_items.to_owned();
     a.sort_by(|a, b| compare_path_list_items(a, b));
     b.sort_by(|a, b| compare_path_list_items(a, b));
     for comparison_pair in a.iter().zip(b.iter()) {