From 7764ab3ff31c80d99955b15b055b7ad26e6e6d13 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 22 Jul 2019 01:26:07 +0300 Subject: [PATCH] Replace C loop with Rust loop in dc_array_search_id --- src/dc_array.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dc_array.rs b/src/dc_array.rs index d52124ddb..2420e08c9 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -237,16 +237,13 @@ pub unsafe fn dc_array_search_id( return false; } let data: *mut uintptr_t = (*array).array; - let mut i: size_t = 0; - let cnt: size_t = (*array).count; - while i < cnt { + for i in 0..(*array).count { if *data.offset(i as isize) == needle as size_t { if !ret_index.is_null() { *ret_index = i } return true; } - i = i.wrapping_add(1) } false }