mirror of
https://github.com/Noratrieb/datastructures.git
synced 2026-01-15 18:05:02 +01:00
IntoIter leak test
This commit is contained in:
parent
192f38a42d
commit
96b2396af2
1 changed files with 6 additions and 0 deletions
|
|
@ -141,6 +141,12 @@ fn std_traits() {
|
|||
assert_eq!(list1, list_from_vec);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn into_iter_not_consumed() {
|
||||
let list = create_list(&[1, 2, 4, 6, 7, 4, 5, 7, 57, 5]);
|
||||
list.into_iter();
|
||||
}
|
||||
|
||||
/// Creates an owned list from a slice, not efficient at all but easy to use
|
||||
fn create_list<T: Clone>(iter: &[T]) -> LinkedList<T> {
|
||||
iter.into_iter().cloned().collect()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue