From e4ec956001ef9bf14be25da3e1bfd622ef3f4bc8 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 17 Jul 2021 03:11:25 +0100 Subject: [PATCH] fix examples on msrv --- actix-router/examples/flamegraph.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/actix-router/examples/flamegraph.rs b/actix-router/examples/flamegraph.rs index 0c69566b..89527e2f 100644 --- a/actix-router/examples/flamegraph.rs +++ b/actix-router/examples/flamegraph.rs @@ -135,21 +135,18 @@ macro_rules! register { concat!("/user/keys"), concat!("/user/keys/", $p1), ]; - std::array::IntoIter::new(arr) + + arr.to_vec() }}; } -fn call() -> impl Iterator { - let arr = [ - "/authorizations", - "/user/repos", - "/repos/rust-lang/rust/stargazers", - "/orgs/rust-lang/public_members/nikomatsakis", - "/repos/rust-lang/rust/releases/1.51.0", - ]; - - std::array::IntoIter::new(arr) -} +static PATHS: [&'static str; 5] = [ + "/authorizations", + "/user/repos", + "/repos/rust-lang/rust/stargazers", + "/orgs/rust-lang/public_members/nikomatsakis", + "/repos/rust-lang/rust/releases/1.51.0", +]; fn main() { let mut router = actix_router::Router::::build(); @@ -162,7 +159,7 @@ fn main() { if firestorm::enabled() { firestorm::bench("target", || { - for route in call() { + for &route in &PATHS { let mut path = actix_router::Path::new(route); actix.recognize(&mut path).unwrap(); }