Cleanup warnings in stdlib and generated code
This commit is contained in:
@@ -2158,6 +2158,7 @@ public inline fun <T> Array<out T>.single(predicate: (T) -> Boolean): T {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as T
|
||||
}
|
||||
|
||||
@@ -2175,6 +2176,7 @@ public inline fun ByteArray.single(predicate: (Byte) -> Boolean): Byte {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Byte
|
||||
}
|
||||
|
||||
@@ -2192,6 +2194,7 @@ public inline fun ShortArray.single(predicate: (Short) -> Boolean): Short {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Short
|
||||
}
|
||||
|
||||
@@ -2209,6 +2212,7 @@ public inline fun IntArray.single(predicate: (Int) -> Boolean): Int {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Int
|
||||
}
|
||||
|
||||
@@ -2226,6 +2230,7 @@ public inline fun LongArray.single(predicate: (Long) -> Boolean): Long {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Long
|
||||
}
|
||||
|
||||
@@ -2243,6 +2248,7 @@ public inline fun FloatArray.single(predicate: (Float) -> Boolean): Float {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Float
|
||||
}
|
||||
|
||||
@@ -2260,6 +2266,7 @@ public inline fun DoubleArray.single(predicate: (Double) -> Boolean): Double {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Double
|
||||
}
|
||||
|
||||
@@ -2277,6 +2284,7 @@ public inline fun BooleanArray.single(predicate: (Boolean) -> Boolean): Boolean
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Boolean
|
||||
}
|
||||
|
||||
@@ -2294,6 +2302,7 @@ public inline fun CharArray.single(predicate: (Char) -> Boolean): Char {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Array contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Char
|
||||
}
|
||||
|
||||
|
||||
@@ -255,6 +255,7 @@ public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.indexOf(element: T):
|
||||
/**
|
||||
* Returns first index of [element], or -1 if the list does not contain element.
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER") // false warning, extension takes precedence in some cases
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> List<T>.indexOf(element: T): Int {
|
||||
return indexOf(element)
|
||||
}
|
||||
@@ -355,6 +356,7 @@ public inline fun <T> Iterable<T>.last(predicate: (T) -> Boolean): T {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Collection contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return last as T
|
||||
}
|
||||
|
||||
@@ -389,6 +391,7 @@ public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.lastIndexOf(element:
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the list does not contain element.
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER") // false warning, extension takes precedence in some cases
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> List<T>.lastIndexOf(element: T): Int {
|
||||
return lastIndexOf(element)
|
||||
}
|
||||
@@ -486,6 +489,7 @@ public inline fun <T> Iterable<T>.single(predicate: (T) -> Boolean): T {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Collection contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as T
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +209,7 @@ public inline fun <T> Sequence<T>.last(predicate: (T) -> Boolean): T {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Sequence contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return last as T
|
||||
}
|
||||
|
||||
@@ -289,6 +290,7 @@ public inline fun <T> Sequence<T>.single(predicate: (T) -> Boolean): T {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Sequence contains no element matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as T
|
||||
}
|
||||
|
||||
|
||||
@@ -189,6 +189,7 @@ public inline fun CharSequence.single(predicate: (Char) -> Boolean): Char {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("Char sequence contains no character matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as Char
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user