]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/slow_vector_initialization.rs
iterate List by value
[rust.git] / tests / ui / slow_vector_initialization.rs
index daa6b9c13769d97a14f9802a966f50d8888fb3e7..c5ae3ff769b11bb8dd6513a95728fb16fb18d7d1 100644 (file)
@@ -1,19 +1,9 @@
-// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use std::iter::repeat;
 
 fn main() {
     resize_vector();
     extend_vector();
     mixed_extend_resize_vector();
-    unsafe_vector();
 }
 
 fn extend_vector() {
@@ -63,21 +53,11 @@ fn resize_vector() {
     vec1.resize(10, 0);
 }
 
-fn unsafe_vector() {
-    let mut unsafe_vec: Vec<u8> = Vec::with_capacity(200);
-
-    unsafe {
-        unsafe_vec.set_len(200);
-    }
-}
-
-fn do_stuff(vec: &mut Vec<u8>) {
-
-}
+fn do_stuff(vec: &mut Vec<u8>) {}
 
 fn extend_vector_with_manipulations_between() {
     let len = 300;
-    let mut vec1:Vec<u8> = Vec::with_capacity(len);
+    let mut vec1: Vec<u8> = Vec::with_capacity(len);
     do_stuff(&mut vec1);
     vec1.extend(repeat(0).take(len));
 }