From 91edd1d6794193eae2cd6045c4cf87851f18b1e9 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 16 Jul 2020 16:21:49 +0200 Subject: [PATCH] fix unconditional_panic warning --- beginner/apps/src/bin/panic.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beginner/apps/src/bin/panic.rs b/beginner/apps/src/bin/panic.rs index ec16d9b..eb86bc7 100644 --- a/beginner/apps/src/bin/panic.rs +++ b/beginner/apps/src/bin/panic.rs @@ -24,9 +24,13 @@ fn foo() { #[inline(never)] fn bar() { - let i = 3; + let i = index(); let array = [0, 1, 2]; let x = array[i]; // out of bounds access log::info!("{}", x); } + +fn index() -> usize { + 3 +}