Move some test-only code to test files
This also relaxes the bounds on some structs and moves them to the impl block instead.
This commit is contained in:
@@ -3,6 +3,17 @@ use super::*;
|
||||
extern crate test;
|
||||
use test::{black_box, Bencher};
|
||||
|
||||
impl<T> TinyList<T> {
|
||||
fn len(&self) -> usize {
|
||||
let (mut elem, mut count) = (self.head.as_ref(), 0);
|
||||
while let Some(ref e) = elem {
|
||||
count += 1;
|
||||
elem = e.next.as_deref();
|
||||
}
|
||||
count
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_contains_and_insert() {
|
||||
fn do_insert(i: u32) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user