From 775d16cce332d0f1074578284ea9815d8e4407c6 Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 25 Dec 2020 23:21:23 +0800 Subject: [PATCH] array: remove redundant index method in array.v (#7523) --- vlib/builtin/array.v | 45 -------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index 04f6e17665..d24877d046 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -597,51 +597,6 @@ pub fn (a []string) index(v string) int { return -1 } -// index returns the first index at which a given element can be found in the array -// or -1 if the value is not found. -pub fn (a []int) index(v int) int { - for i in 0 .. a.len { - if a[i] == v { - return i - } - } - return -1 -} - -// index returns the first index at which a given element can be found in the array -// or -1 if the value is not found. -pub fn (a []byte) index(v byte) int { - for i in 0 .. a.len { - if a[i] == v { - return i - } - } - return -1 -} - -// index returns the first index at which a given element can be found in the array -// or -1 if the value is not found. -pub fn (a []rune) index(v rune) int { - for i in 0 .. a.len { - if a[i] == v { - return i - } - } - return -1 -} - -// index returns the first index at which a given element can be found in the array -// or -1 if the value is not found. -// TODO is `char` type yet in the language? -pub fn (a []char) index(v char) int { - for i in 0 .. a.len { - if a[i] == v { - return i - } - } - return -1 -} - // reduce executes a given reducer function on each element of the array, // resulting in a single output value. pub fn (a []int) reduce(iter fn (int, int) int, accum_start int) int {