#![allow(dead_code, deprecated, unused_variables, unused_mut)] use std::hint::black_box; fn contains(haystack: &[&str], needle: &str) -> bool { haystack.iter().any(|x| x == &needle) } pub fn benchmark() { let haystack = vec!["abc", "def", "ghi", "jkl", "mno"]; let needle = "ghi"; for _ in 0..10 { black_box(contains(black_box(&haystack), black_box(needle))); } } fn main() {}