From 1f63753a8b21d4d905642f642b147bf4e37f37b5 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 23 Jul 2019 00:11:35 +0300 Subject: [PATCH] Simplify dc_array_search_id --- src/dc_array.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dc_array.rs b/src/dc_array.rs index 93e5dbe7f..3991e3fd1 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -233,8 +233,8 @@ pub unsafe fn dc_array_search_id( if array.is_null() { return false; } - for i in 0..(*array).array.len() { - if (*array).array[i] == needle as size_t { + for (i, &u) in (*array).array.iter().enumerate() { + if u == needle as size_t { if !ret_index.is_null() { *ret_index = i }