]> git.proxmox.com Git - cargo.git/commitdiff
Use indexing instead of get() function to access Vec
authorFlorian Hahn <flo@fhahn.com>
Thu, 17 Jul 2014 20:20:13 +0000 (22:20 +0200)
committerFlorian Hahn <flo@fhahn.com>
Thu, 17 Jul 2014 20:27:02 +0000 (22:27 +0200)
src/cargo/core/resolver.rs
src/cargo/ops/cargo_rustc/context.rs
tests/test_cargo_compile.rs

index 35de124c2f94059fde1243e3aed64f0f7637cf03..68ba69f414974cc85932d276fdc07b62124ebda4 100644 (file)
@@ -78,7 +78,7 @@ fn resolve_deps<'a, R: Registry>(parent: &PackageId,
                 single source for a particular package name ({}).", dep)));
         }
 
-        let summary = pkgs.get(0).clone();
+        let summary = pkgs[0].clone();
         let name = summary.get_name().to_string();
         let source_id = summary.get_source_id().clone();
         let version = summary.get_version().clone();
index 9f6853402d281064f44c3816c6f7bd17001dfc5b..d6b43371d2d0e8dce70fcb95bba2aefa7a2ca53e 100644 (file)
@@ -83,7 +83,7 @@ impl<'a, 'b> Context<'a, 'b> {
         let parts: Vec<&str> = output.trim().split('-').collect();
         assert!(parts.len() == 2, "rustc --print-file-name output has changed");
 
-        Ok((parts.get(0).to_string(), parts.get(1).to_string()))
+        Ok((parts[0].to_string(), parts[1].to_string()))
     }
 
     /// Prepare this context, ensuring that all filesystem directories are in
index 2a3290b2eda2d7f23f49e91b326d9d68960d7796..ae9ebf2f8eeab98c19b19b9fb71cabf919d3ffb9 100644 (file)
@@ -837,8 +837,8 @@ test!(many_crate_types_old_style_lib_location {
         }
     }).collect();
     files.sort();
-    let file0 = files.get(0).as_slice();
-    let file1 = files.get(1).as_slice();
+    let file0 = files[0].as_slice();
+    let file1 = files[1].as_slice();
     println!("{} {}", file0, file1);
     assert!(file0.ends_with(".rlib") || file1.ends_with(".rlib"));
     assert!(file0.ends_with(os::consts::DLL_SUFFIX) ||
@@ -875,8 +875,8 @@ test!(many_crate_types_correct {
         }
     }).collect();
     files.sort();
-    let file0 = files.get(0).as_slice();
-    let file1 = files.get(1).as_slice();
+    let file0 = files[0].as_slice();
+    let file1 = files[1].as_slice();
     println!("{} {}", file0, file1);
     assert!(file0.ends_with(".rlib") || file1.ends_with(".rlib"));
     assert!(file0.ends_with(os::consts::DLL_SUFFIX) ||