Skip to content

Commit

Permalink
Rename a variable. NFC.
Browse files Browse the repository at this point in the history
"builder" -> "result", as requested by @gribozavr.
  • Loading branch information
nadavrot committed Dec 2, 2015
1 parent 2b47167 commit b6c284b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions stdlib/public/core/Collection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,17 @@ extension CollectionType {
return []
}

var builder = ContiguousArray<T>()
builder.reserveCapacity(count)
var result = ContiguousArray<T>()
result.reserveCapacity(count)

var i = self.startIndex

for _ in 0..<count {
builder.append(try transform(self[i++]))
result.append(try transform(self[i++]))
}

_expectEnd(i, self)
return Array(builder)
return Array(result)
}

/// Returns a subsequence containing all but the first `n` elements.
Expand Down
16 changes: 8 additions & 8 deletions stdlib/public/core/Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,20 +295,20 @@ extension SequenceType {
@noescape transform: (Generator.Element) throws -> T
) rethrows -> [T] {
let initialCapacity = underestimateCount()
var builder = ContiguousArray<T>()
builder.reserveCapacity(initialCapacity)
var result = ContiguousArray<T>()
result.reserveCapacity(initialCapacity)

var generator = generate()

// Add elements up to the initial capacity without checking for regrowth.
for _ in 0..<initialCapacity {
builder.append(try transform(generator.next()!))
result.append(try transform(generator.next()!))
}
// Add remaining elements, if any.
while let element = generator.next() {
builder.append(try transform(element))
result.append(try transform(element))
}
return Array(builder)
return Array(result)
}

/// Return an `Array` containing the elements of `self`,
Expand All @@ -318,17 +318,17 @@ extension SequenceType {
@noescape includeElement: (Generator.Element) throws -> Bool
) rethrows -> [Generator.Element] {

var builder = ContiguousArray<Generator.Element>()
var result = ContiguousArray<Generator.Element>()

var generator = generate()

while let element = generator.next() {
if try includeElement(element) {
builder.append(element)
result.append(element)
}
}

return Array(builder)
return Array(result)
}

/// Returns a subsequence containing all but the first `n` elements.
Expand Down

0 comments on commit b6c284b

Please sign in to comment.