Skip to content

Commit

Permalink
Migrate some rethrows to typed throws
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Aug 24, 2024
1 parent 3c818e2 commit 73d4f6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CotEditor/Sources/Collection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ extension Collection {

extension Sequence {

// Asynchronously returns an array containing the results of mapping the given closure over the sequence’s elements.
func asyncMap<T>(_ transform: @Sendable (Element) async throws -> T) async rethrows -> [T] {
/// Asynchronously returns an array containing the results of mapping the given closure over the sequence’s elements.
func asyncMap<T, E: Error>(_ transform: @Sendable (Element) async throws(E) -> T) async throws(E) -> [T] {

var values = [T]()
for element in self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension Collection {
/// - range: The range to find in.
/// - predicate: A closure that takes an element as its argument and returns a Boolean value that indicates whether the passed element represents a match.
/// - Returns: The index.
func binarySearchedFirstIndex(in range: Range<Index>? = nil, where predicate: (Element) throws -> Bool) rethrows -> Index? {
func binarySearchedFirstIndex<E: Error>(in range: Range<Index>? = nil, where predicate: (Element) throws(E) -> Bool) throws(E) -> Index? {

let range = range ?? self.startIndex..<self.endIndex

Expand Down

0 comments on commit 73d4f6d

Please sign in to comment.