Skip to content

Commit 6536edd

Browse files
committed
stdlib: fix coding style
Swift SVN r32425
1 parent f7005d5 commit 6536edd

37 files changed

+181
-141
lines changed

stdlib/private/StdlibUnittest/CheckMutableCollectionType.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public let partitionExhaustiveTests = [
4848
PartitionExhaustiveTest([ 10, 20, 30, 40, 50, 60, 70 ]),
4949
]
5050

51-
public func withInvalidOrderings(body: ((Int,Int) -> Bool) -> ()) {
51+
public func withInvalidOrderings(body: ((Int,Int) -> Bool) -> Void) {
5252
// Test some ordering predicates that don't create strict weak orderings
5353
body { (_,_) in true }
5454
body { (_,_) in false }

stdlib/private/StdlibUnittest/LoggingWrappers.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public struct Logging${Kind}<Base: ${Kind}Type> : ${Kind}Type, LoggingType {
458458
}
459459

460460
public func forEach(
461-
@noescape body: (Base.Generator.Element) throws -> ()
461+
@noescape body: (Base.Generator.Element) throws -> Void
462462
) rethrows {
463463
++Log.forEach[selfType]
464464
try base.forEach(body)

stdlib/private/StdlibUnittest/RaceTest.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import Glibc
4747
#if _runtime(_ObjC)
4848
import ObjectiveC
4949
#else
50-
func autoreleasepool(@noescape code: () -> ()) {
50+
func autoreleasepool(@noescape code: () -> Void) {
5151
// Native runtime does not have autorelease pools. Execute the code
5252
// directly.
5353
code()
@@ -92,8 +92,9 @@ public protocol RaceTestWithPerTrialDataType {
9292

9393
/// Evaluates the observations made by all threads for a particular instance
9494
/// of `RaceData`.
95-
func evaluateObservations(observations: [Observation],
96-
_ sink: (RaceTestObservationEvaluation) -> ())
95+
func evaluateObservations(
96+
observations: [Observation],
97+
_ sink: (RaceTestObservationEvaluation) -> Void)
9798
}
9899

99100
/// The result of evaluating observations.

stdlib/private/StdlibUnittest/StdlibCoreExtras.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ extension TypeIdentifier
137137
func _forAllPermutationsImpl(
138138
index: Int, _ size: Int,
139139
inout _ perm: [Int], inout _ visited: [Bool],
140-
_ body: ([Int]) -> ()
140+
_ body: ([Int]) -> Void
141141
) {
142142
if index == size {
143143
body(perm)
@@ -156,7 +156,7 @@ func _forAllPermutationsImpl(
156156
}
157157

158158
/// Generate all permutations.
159-
public func forAllPermutations(size: Int, body: ([Int]) -> ()) {
159+
public func forAllPermutations(size: Int, body: ([Int]) -> Void) {
160160
if size == 0 {
161161
return
162162
}
@@ -168,7 +168,7 @@ public func forAllPermutations(size: Int, body: ([Int]) -> ()) {
168168

169169
/// Generate all permutations.
170170
public func forAllPermutations<S : SequenceType>(
171-
sequence: S, body: ([S.Generator.Element]) -> ()
171+
sequence: S, body: ([S.Generator.Element]) -> Void
172172
) {
173173
let data = Array(sequence)
174174
forAllPermutations(data.count) {

stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var _seenExpectCrash = false
119119
/// Run `body` and expect a failure to happen.
120120
///
121121
/// The check passes iff `body` triggers one or more failures.
122-
public func expectFailure(${TRACE1}, body: () -> ()) {
122+
public func expectFailure(${TRACE1}, body: () -> Void) {
123123
let startAnyExpectFailed = _anyExpectFailed
124124
_anyExpectFailed = false
125125
body()
@@ -399,9 +399,9 @@ func _defaultTestSuiteFailedCallback() {
399399
abort()
400400
}
401401

402-
var _testSuiteFailedCallback: () -> () = _defaultTestSuiteFailedCallback
402+
var _testSuiteFailedCallback: () -> Void = _defaultTestSuiteFailedCallback
403403

404-
public func _setTestSuiteFailedCallback(callback: () -> ()) {
404+
public func _setTestSuiteFailedCallback(callback: () -> Void) {
405405
_testSuiteFailedCallback = callback
406406
}
407407

@@ -828,8 +828,8 @@ public class TestSuite {
828828
public func test(
829829
name: String,
830830
file: String = __FILE__, line: UInt = __LINE__,
831-
_ testFunction: () -> ()) {
832-
831+
_ testFunction: () -> Void
832+
) {
833833
_TestBuilder(testSuite: self, name: name, loc: SourceLoc(file, line))
834834
.code(testFunction)
835835
}
@@ -840,12 +840,12 @@ public class TestSuite {
840840
return _TestBuilder(testSuite: self, name: name, loc: SourceLoc(file, line))
841841
}
842842

843-
public func setUp(code: () -> ()) {
843+
public func setUp(code: () -> Void) {
844844
_precondition(_testSetUpCode == nil, "set-up code already set")
845845
_testSetUpCode = code
846846
}
847847

848-
public func tearDown(code: () -> ()) {
848+
public func tearDown(code: () -> Void) {
849849
_precondition(_testTearDownCode == nil, "tear-down code already set")
850850
_testTearDownCode = code
851851
}
@@ -880,7 +880,7 @@ public class TestSuite {
880880
let stdinText: String?
881881
let stdinEndsWithEOF: Bool
882882
let crashOutputMatches: [String]
883-
let code: () -> ()
883+
let code: () -> Void
884884

885885
/// Whether the test harness should stop reusing the child process after
886886
/// running this test.
@@ -938,7 +938,7 @@ public class TestSuite {
938938
return self
939939
}
940940

941-
public func code(testFunction: () -> ()) {
941+
public func code(testFunction: () -> Void) {
942942
_testSuite._tests.append(
943943
_Test(
944944
name: _name, testLoc: _data._testLoc!, xfail: _data._xfail,
@@ -954,10 +954,10 @@ public class TestSuite {
954954
var _tests: [_Test] = []
955955

956956
/// Code that is run before every test.
957-
var _testSetUpCode: (() -> ())?
957+
var _testSetUpCode: (() -> Void)?
958958

959959
/// Code that is run after every test.
960-
var _testTearDownCode: (() -> ())?
960+
var _testTearDownCode: (() -> Void)?
961961

962962
/// Maps test name to index in `_tests`.
963963
var _testNameToIndex: [String : Int] = [:]

stdlib/private/StdlibUnittestFoundationExtras/StdlibUnittestFoundationExtras.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public func withOverriddenNSLocaleCurrentLocale<Result>(
6565
/// return-autoreleased optimization.)
6666
@inline(never)
6767
public func autoreleasepoolIfUnoptimizedReturnAutoreleased(
68-
@noescape body: () -> ()
68+
@noescape body: () -> Void
6969
) {
7070
#if arch(i386) && (os(iOS) || os(watchOS))
7171
autoreleasepool(body)

stdlib/private/SwiftPrivate/IO.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public struct _FDOutputStream : OutputStreamType {
102102
public mutating func write(string: String) {
103103
let utf8 = string.nulTerminatedUTF8
104104
utf8.withUnsafeBufferPointer {
105-
(utf8) -> () in
105+
(utf8) -> Void in
106106
var writtenBytes = 0
107107
let bufferSize = utf8.count - 1
108108
while writtenBytes != bufferSize {

stdlib/public/SDK/Foundation/Foundation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,16 +1227,16 @@ extension NSDictionary {
12271227
internal func NS_Swift_NSUndoManager_registerUndoWithTargetHandler(
12281228
self_: AnyObject,
12291229
_ target: AnyObject,
1230-
_ handler: @convention(block) AnyObject -> ())
1230+
_ handler: @convention(block) (AnyObject) -> Void)
12311231

12321232
extension NSUndoManager {
12331233
@available(OSX 10.11, iOS 9.0, *)
12341234
public func registerUndoWithTarget<TargetType : AnyObject>(
1235-
target: TargetType, handler: TargetType -> ()
1235+
target: TargetType, handler: (TargetType) -> Void
12361236
) {
12371237
// The generic blocks use a different ABI, so we need to wrap the provided
12381238
// handler in something ObjC compatible.
1239-
let objcCompatibleHandler: AnyObject -> () = { internalTarget in
1239+
let objcCompatibleHandler: (AnyObject) -> Void = { internalTarget in
12401240
handler(internalTarget as! TargetType)
12411241
}
12421242
NS_Swift_NSUndoManager_registerUndoWithTargetHandler(

stdlib/public/SDK/ObjectiveC/ObjectiveC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func __pushAutoreleasePool() -> COpaquePointer
201201
@asmname("objc_autoreleasePoolPop")
202202
func __popAutoreleasePool(pool: COpaquePointer)
203203

204-
public func autoreleasepool(@noescape code: () -> ()) {
204+
public func autoreleasepool(@noescape code: () -> Void) {
205205
let pool = __pushAutoreleasePool()
206206
code()
207207
__popAutoreleasePool(pool)

stdlib/public/core/AssertCommon.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ func _assertionFailed(
9696
_ file: StaticString, _ line: UInt
9797
) {
9898
prefix.withUTF8Buffer {
99-
(prefix) -> () in
99+
(prefix) -> Void in
100100
message.withUTF8Buffer {
101-
(message) -> () in
101+
(message) -> Void in
102102
file.withUTF8Buffer {
103-
(file) -> () in
103+
(file) -> Void in
104104
_reportFatalErrorInFile(
105105
prefix.baseAddress, UInt(prefix.count),
106106
message.baseAddress, UInt(message.count),
@@ -124,12 +124,12 @@ func _assertionFailed(
124124
_ file: StaticString, _ line: UInt
125125
) {
126126
prefix.withUTF8Buffer {
127-
(prefix) -> () in
127+
(prefix) -> Void in
128128
let messageUTF8 = message.nulTerminatedUTF8
129129
messageUTF8.withUnsafeBufferPointer {
130-
(messageUTF8) -> () in
130+
(messageUTF8) -> Void in
131131
file.withUTF8Buffer {
132-
(file) -> () in
132+
(file) -> Void in
133133
_reportFatalErrorInFile(
134134
prefix.baseAddress, UInt(prefix.count),
135135
messageUTF8.baseAddress, UInt(messageUTF8.count),

stdlib/public/core/Character.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public struct Character :
3737
var asInt: UInt64 = 0
3838
var shift: UInt64 = 0
3939

40-
let output: (UTF8.CodeUnit) -> () = {
40+
let output: (UTF8.CodeUnit) -> Void = {
4141
asInt |= UInt64($0) << shift
4242
shift += 8
4343
}
@@ -204,7 +204,7 @@ public struct Character :
204204
_sanityCheck(count <= 4, "Character with more than 4 UTF-16 code units")
205205
self.count = UInt16(count)
206206
var u16: UInt64 = 0
207-
let output: (UTF16.CodeUnit) -> () = {
207+
let output: (UTF16.CodeUnit) -> Void = {
208208
u16 = u16 << 16
209209
u16 = u16 | UInt64($0)
210210
}

stdlib/public/core/CollectionAlgorithms.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ ${orderingRequirementForComparable}
260260
public mutating func sortInPlace() {
261261
let didSortUnsafeBuffer: Void? =
262262
_withUnsafeMutableBufferPointerIfSupported {
263-
(baseAddress, count) -> () in
263+
(baseAddress, count) -> Void in
264264
var bufferPointer =
265265
UnsafeMutableBufferPointer(start: baseAddress, count: count)
266266
bufferPointer.sortInPlace()
@@ -288,7 +288,7 @@ ${orderingRequirementForPredicate}
288288

289289
let didSortUnsafeBuffer: Void? =
290290
_withUnsafeMutableBufferPointerIfSupported {
291-
(baseAddress, count) -> () in
291+
(baseAddress, count) -> Void in
292292
var bufferPointer =
293293
UnsafeMutableBufferPointer(start: baseAddress, count: count)
294294
bufferPointer.sortInPlace(escapableIsOrderedBefore)

stdlib/public/core/Sequence.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public protocol SequenceType {
123123
/// skip subsequent calls.
124124
///
125125
/// - Complexity: O(`self.count`)
126-
func forEach(@noescape body: (Generator.Element) throws -> ()) rethrows
126+
func forEach(@noescape body: (Generator.Element) throws -> Void) rethrows
127127

128128
/// Returns a subsequence containing all but the first `n` elements.
129129
///
@@ -575,7 +575,7 @@ extension SequenceType {
575575
///
576576
/// - Complexity: O(`self.count`)
577577
public func forEach(
578-
@noescape body: (Generator.Element) throws -> ()
578+
@noescape body: (Generator.Element) throws -> Void
579579
) rethrows {
580580
for element in self {
581581
try body(element)

stdlib/public/core/StaticString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public struct StaticString
117117
} else {
118118
var buffer: UInt64 = 0
119119
var i = 0
120-
let sink: (UInt8) -> () = {
120+
let sink: (UInt8) -> Void = {
121121
buffer = buffer | (UInt64($0) << (UInt64(i) * 8))
122122
++i
123123
}

stdlib/public/core/String.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ extension String {
272272
Encoding: UnicodeCodecType
273273
>(encoding: Encoding.Type) -> Int {
274274
var codeUnitCount = 0
275-
let output: (Encoding.CodeUnit) -> () = { _ in ++codeUnitCount }
275+
let output: (Encoding.CodeUnit) -> Void = { _ in ++codeUnitCount }
276276
self._encode(encoding, output: output)
277277
return codeUnitCount
278278
}
@@ -286,7 +286,7 @@ extension String {
286286
// with unpaired surrogates
287287
func _encode<
288288
Encoding: UnicodeCodecType
289-
>(encoding: Encoding.Type, output: (Encoding.CodeUnit) -> ())
289+
>(encoding: Encoding.Type, output: (Encoding.CodeUnit) -> Void)
290290
{
291291
return _core.encode(encoding, output: output)
292292
}

stdlib/public/core/StringBuffer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public struct _StringBuffer {
105105

106106
if isAscii {
107107
var p = UnsafeMutablePointer<UTF8.CodeUnit>(result.start)
108-
let sink: (UTF32.CodeUnit) -> () = {
108+
let sink: (UTF32.CodeUnit) -> Void = {
109109
(p++).memory = UTF8.CodeUnit($0)
110110
}
111111
let hadError = transcode(
@@ -116,7 +116,7 @@ public struct _StringBuffer {
116116
}
117117
else {
118118
var p = result._storage.baseAddress
119-
let sink: (UTF16.CodeUnit) -> () = {
119+
let sink: (UTF16.CodeUnit) -> Void = {
120120
(p++).memory = $0
121121
}
122122
let hadError = transcode(

stdlib/public/core/StringCore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public struct _StringCore {
322322
/// Write the string, in the given encoding, to output.
323323
func encode<
324324
Encoding: UnicodeCodecType
325-
>(encoding: Encoding.Type, output: (Encoding.CodeUnit) -> ())
325+
>(encoding: Encoding.Type, output: (Encoding.CodeUnit) -> Void)
326326
{
327327
if _fastPath(_baseAddress != nil) {
328328
if _fastPath(elementWidth == 1) {

stdlib/public/core/Unicode.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public protocol UnicodeCodecType {
6666

6767
/// Encode a `UnicodeScalar` as a series of `CodeUnit`s by
6868
/// calling `output` on each `CodeUnit`.
69-
static func encode(input: UnicodeScalar, output: (CodeUnit) -> ())
69+
static func encode(input: UnicodeScalar, output: (CodeUnit) -> Void)
7070
}
7171

7272
/// A codec for [UTF-8](http://www.unicode.org/glossary/#UTF_8).
@@ -444,7 +444,10 @@ public struct UTF8 : UnicodeCodecType {
444444

445445
/// Encode a `UnicodeScalar` as a series of `CodeUnit`s by
446446
/// calling `output` on each `CodeUnit`.
447-
public static func encode(input: UnicodeScalar, output put: (CodeUnit) -> ()) {
447+
public static func encode(
448+
input: UnicodeScalar,
449+
output put: (CodeUnit) -> Void
450+
) {
448451
var c = UInt32(input)
449452
var buf3 = UInt8(c & 0xFF)
450453

@@ -610,7 +613,10 @@ public struct UTF16 : UnicodeCodecType {
610613

611614
/// Encode a `UnicodeScalar` as a series of `CodeUnit`s by
612615
/// calling `output` on each `CodeUnit`.
613-
public static func encode(input: UnicodeScalar, output put: (CodeUnit) -> ()) {
616+
public static func encode(
617+
input: UnicodeScalar,
618+
output put: (CodeUnit) -> Void
619+
) {
614620
let scalarValue: UInt32 = UInt32(input)
615621

616622
if scalarValue <= UInt32(UInt16.max) {
@@ -665,8 +671,10 @@ public struct UTF32 : UnicodeCodecType {
665671

666672
/// Encode a `UnicodeScalar` as a series of `CodeUnit`s by
667673
/// calling `output` on each `CodeUnit`.
668-
public static func encode(input: UnicodeScalar,
669-
output put: (CodeUnit) -> ()) {
674+
public static func encode(
675+
input: UnicodeScalar,
676+
output put: (CodeUnit) -> Void
677+
) {
670678
put(UInt32(input))
671679
}
672680
}
@@ -683,7 +691,7 @@ public func transcode<
683691
OutputEncoding : UnicodeCodecType
684692
where InputEncoding.CodeUnit == Input.Element>(
685693
inputEncoding: InputEncoding.Type, _ outputEncoding: OutputEncoding.Type,
686-
var _ input: Input, _ output: (OutputEncoding.CodeUnit) -> (),
694+
var _ input: Input, _ output: (OutputEncoding.CodeUnit) -> Void,
687695
stopOnError: Bool
688696
) -> Bool {
689697

0 commit comments

Comments
 (0)