Skip to content

Commit ebb0c3a

Browse files
committed
replaced single-line ++/-- with +=/-=
1 parent c258f99 commit ebb0c3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+137
-137
lines changed

stdlib/private/StdlibUnittest/RaceTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ struct _RaceTestAggregatedEvaluations : CustomStringConvertible {
342342
mutating func addEvaluation(evaluation: RaceTestObservationEvaluation) {
343343
switch evaluation {
344344
case .Pass:
345-
++passCount
345+
passCount += 1
346346

347347
case .PassInteresting(let s):
348348
if passInterestingCount[s] == nil {
@@ -351,7 +351,7 @@ struct _RaceTestAggregatedEvaluations : CustomStringConvertible {
351351
passInterestingCount[s] = passInterestingCount[s]! + 1
352352

353353
case .Failure:
354-
++failureCount
354+
failureCount += 1
355355

356356
case .FailureInteresting(let s):
357357
if failureInterestingCount[s] == nil {

stdlib/private/SwiftPrivate/IO.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public struct _FDInputStream {
4949
_buffer.reserveCapacity(minFree - bufferFree)
5050
while bufferFree < minFree {
5151
_buffer.append(0)
52-
++bufferFree
52+
bufferFree += 1
5353
}
5454
}
5555
let readResult: __swift_ssize_t = _buffer.withUnsafeMutableBufferPointer {

stdlib/public/SDK/Foundation/Foundation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ final public class NSFastGenerator : GeneratorType {
696696
if count == 0 { return .None }
697697
}
698698
let next : AnyObject = state[0].itemsPtr[n]!
699-
++n
699+
n += 1
700700
return next
701701
}
702702

stdlib/public/SDK/Foundation/NSStringAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func _countFormatSpecifiers(a: String) -> Int {
5454
lastChar = notPercentUTF16
5555
}
5656
else {
57-
++count
57+
count += 1
5858
lastChar = c
5959
}
6060
} else {
@@ -141,7 +141,7 @@ extension String {
141141
var p = NSString.availableStringEncodings()
142142
while p.memory != 0 {
143143
result.append(p.memory)
144-
++p
144+
p += 1
145145
}
146146
return result
147147
}

stdlib/public/core/ArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ extension _ArrayBuffer {
225225
var result = target
226226
for _ in subRange {
227227
result.initialize(result.memory)
228-
++result
228+
result += 1
229229
}
230230
return result
231231
}

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ internal struct _UnsafePartiallyInitializedContiguousArrayBuffer<Element> {
663663
mutating func addWithExistingCapacity(element: Element) {
664664
_sanityCheck(remainingCapacity > 0,
665665
"_UnsafePartiallyInitializedContiguousArrayBuffer has no more capacity")
666-
remainingCapacity--
666+
remainingCapacity -= 1
667667

668668
(p++).initialize(element)
669669
}

stdlib/public/core/Reflection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func _dumpWithMirror<TargetStream : OutputStreamType>(
175175
inout _ targetStream: TargetStream
176176
) {
177177
if maxItemCounter <= 0 { return }
178-
--maxItemCounter
178+
maxItemCounter -= 1
179179

180180
for _ in 0..<indent { print(" ", terminator: "", toStream: &targetStream) }
181181

stdlib/public/core/Sequence.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ internal class _DropFirstSequence<Base : GeneratorType>
240240
dropped = limit
241241
return nil
242242
}
243-
++dropped
243+
dropped += 1
244244
}
245245
return generator.next()
246246
}
@@ -270,7 +270,7 @@ internal class _PrefixSequence<Base : GeneratorType> : SequenceType, GeneratorTy
270270

271271
internal func next() -> Base.Element? {
272272
if taken >= maxLength { return nil }
273-
++taken
273+
taken += 1
274274

275275
if let next = generator.next() {
276276
return next

stdlib/public/core/StaticString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public struct StaticString
119119
var i = 0
120120
let sink: (UInt8) -> Void = {
121121
buffer = buffer | (UInt64($0) << (UInt64(i) * 8))
122-
++i
122+
i += 1
123123
}
124124
UTF8.encode(unicodeScalar, output: sink)
125125
return body(UnsafeBufferPointer(

stdlib/public/core/StringUnicodeScalarView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extension String {
7777
let codeUnit = _core[--i]
7878
if _slowPath((codeUnit >> 10) == 0b1101_11) {
7979
if i != 0 && (_core[i - 1] >> 10) == 0b1101_10 {
80-
--i
80+
i -= 1
8181
}
8282
}
8383
return Index(i, _core)

stdlib/public/core/VarArgs.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ final public class VaListBuilder {
398398
+ (sseRegistersUsed * _x86_64SSERegisterWords)
399399
for w in encoded {
400400
storage[startIndex] = w
401-
++startIndex
401+
startIndex += 1
402402
}
403-
++sseRegistersUsed
403+
sseRegistersUsed += 1
404404
}
405405
else if encoded.count == 1 && gpRegistersUsed < _x86_64CountGPRegisters {
406406
storage[gpRegistersUsed++] = encoded[0]

test/1_stdlib/Dispatch.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DispatchAPI.test("OS_OBJECT support") {
3232
DispatchAPI.test("dispatch_block_t conversions") {
3333
var counter = 0
3434
let closure = { () -> Void in
35-
counter++
35+
counter += 1
3636
}
3737

3838
let block = closure as dispatch_block_t
@@ -59,7 +59,7 @@ if #available(OSX 10.10, iOS 8.0, *) {
5959
var counter = 0
6060

6161
let block = dispatch_block_create(dispatch_block_flags_t(0)) {
62-
counter++
62+
counter += 1
6363
}
6464
block()
6565
expectEqual(1, counter)

test/1_stdlib/ErrorHandling.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ErrorHandlingTests.test("ErrorHandling/forEach") {
127127
var loopCount = 0
128128
do {
129129
try [1, 2, 3].forEach {
130-
++loopCount
130+
loopCount += 1
131131
if $0 == 2 {
132132
throw SillyError.JazzHands
133133
}
@@ -143,7 +143,7 @@ ErrorHandlingTests.test("ErrorHandling/Optional flatMap") {
143143
var loopCount = 0
144144
do {
145145
let _: [Int] = try [1, 2, 3].flatMap {
146-
++loopCount
146+
loopCount += 1
147147
if $0 == 2 {
148148
throw SillyError.JazzHands
149149
}
@@ -159,7 +159,7 @@ ErrorHandlingTests.test("ErrorHandling/Array flatMap") {
159159
var loopCount = 0
160160
do {
161161
let _: [Int] = try [1, 2, 3].flatMap {(x) -> [Int] in
162-
++loopCount
162+
loopCount += 1
163163
if x == 2 {
164164
throw SillyError.JazzHands
165165
}
@@ -235,7 +235,7 @@ ErrorHandlingTests.test("ErrorHandling/reduce") {
235235
let x: Int = try [1, 2, 3, 4, 5].reduce(0, combine: {
236236
(x: Int, y: Int) -> Int
237237
in
238-
++loopCount
238+
loopCount += 1
239239
var total = x + y
240240
if total > 5 {
241241
throw SillyError.JazzHands
@@ -287,7 +287,7 @@ ErrorHandlingTests.test("ErrorHandling/Sequence map") {
287287
if loopCount == throwAtCount {
288288
throw SillyError.JazzHands
289289
}
290-
++loopCount
290+
loopCount += 1
291291
return Noisy()
292292
}
293293
expectEqual(NoisyCount, initialCount + 3)
@@ -308,7 +308,7 @@ ErrorHandlingTests.test("ErrorHandling/Sequence filter") {
308308
if loopCount == throwAtCount {
309309
throw SillyError.JazzHands
310310
}
311-
++loopCount
311+
loopCount += 1
312312
return condition
313313
}
314314
expectEqual(NoisyCount, initialCount + sequence.count)
@@ -329,7 +329,7 @@ ErrorHandlingTests.test("ErrorHandling/Collection map") {
329329
if loopCount == throwAtCount {
330330
throw SillyError.JazzHands
331331
}
332-
++loopCount
332+
loopCount += 1
333333
return Noisy()
334334
}
335335
expectEqual(NoisyCount, initialCount + 3)

test/1_stdlib/Inputs/DictionaryKeyValueTypes.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,15 @@ struct TestBridgedValueTy : CustomStringConvertible, _ObjectiveCBridgeable {
428428
}
429429

430430
func _bridgeToObjectiveC() -> TestObjCValueTy {
431-
TestBridgedValueTy.bridgeOperations++
431+
TestBridgedValueTy.bridgeOperations += 1
432432
return TestObjCValueTy(value)
433433
}
434434

435435
static func _forceBridgeFromObjectiveC(
436436
x: TestObjCValueTy,
437437
inout result: TestBridgedValueTy?
438438
) {
439-
TestBridgedValueTy.bridgeOperations++
439+
TestBridgedValueTy.bridgeOperations += 1
440440
result = TestBridgedValueTy(x.value)
441441
}
442442

@@ -637,7 +637,7 @@ func slurpFastEnumerationFromSwift(
637637
for i in 0..<returnedCount {
638638
let value: AnyObject = state.itemsPtr[i]!
639639
sink(value)
640-
++itemsReturned
640+
itemsReturned += 1
641641
}
642642
if maxItems != nil && itemsReturned >= maxItems! {
643643
return
@@ -681,7 +681,7 @@ func slurpFastEnumerationFromSwift(
681681
let value: AnyObject = d.objectForKey(key)!
682682
let kv = (key, value)
683683
sink(kv)
684-
++itemsReturned
684+
itemsReturned += 1
685685
}
686686
if maxItems != nil && itemsReturned >= maxItems! {
687687
return
@@ -999,7 +999,7 @@ func slurpFastEnumerationFromSwift(
999999
for i in 0..<returnedCount {
10001000
let value: AnyObject = state.itemsPtr[i]!
10011001
sink(value)
1002-
++itemsReturned
1002+
itemsReturned += 1
10031003
}
10041004
if maxItems != nil && itemsReturned >= maxItems! {
10051005
return

test/1_stdlib/NSStringAPI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ NSStringAPIs.test("init(UTF8String:)") {
202202
var i = 0
203203
for b in s.utf8 {
204204
up[i] = b
205-
i++
205+
i += 1
206206
}
207207
up[i] = 0
208208
expectOptionalEqual(s, String(UTF8String: UnsafePointer(up)))

test/1_stdlib/Runtime.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import MirrorObjC
1717
var nsObjectCanaryCount = 0
1818
@objc class NSObjectCanary : NSObject {
1919
override init() {
20-
++nsObjectCanaryCount
20+
nsObjectCanaryCount += 1
2121
}
2222
deinit {
23-
--nsObjectCanaryCount
23+
nsObjectCanaryCount -= 1
2424
}
2525
}
2626

@@ -31,10 +31,10 @@ struct NSObjectCanaryStruct {
3131
var swiftObjectCanaryCount = 0
3232
class SwiftObjectCanary {
3333
init() {
34-
++swiftObjectCanaryCount
34+
swiftObjectCanaryCount += 1
3535
}
3636
deinit {
37-
--swiftObjectCanaryCount
37+
swiftObjectCanaryCount -= 1
3838
}
3939
}
4040

@@ -909,14 +909,14 @@ RuntimeFoundationWrappers.test("_stdlib_NSObject_isEqual/NoLeak") {
909909
var nsStringCanaryCount = 0
910910
@objc class NSStringCanary : NSString {
911911
override init() {
912-
++nsStringCanaryCount
912+
nsStringCanaryCount += 1
913913
super.init()
914914
}
915915
required init(coder: NSCoder) {
916916
fatalError("don't call this initializer")
917917
}
918918
deinit {
919-
--nsStringCanaryCount
919+
nsStringCanaryCount -= 1
920920
}
921921
@objc override var length: Int {
922922
return 0
@@ -2266,7 +2266,7 @@ func computeCountLeadingZeroes(x: Int64) -> Int64 {
22662266
var r: Int64 = 64
22672267
while x != 0 {
22682268
x >>= 1
2269-
r--
2269+
r -= 1
22702270
}
22712271
return r
22722272
}

test/1_stdlib/StringReallocation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func testReallocation() {
1515
story += " "
1616
story += s
1717
if lastBase != story._core._baseAddress {
18-
++reallocations
18+
reallocations += 1
1919

2020
// To avoid dumping a vast string here, just write the first
2121
// part of the story out each time there's a reallocation.

test/1_stdlib/Zip.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var i = 0
1010
var prefix = ""
1111
for p in zip(n, s) {
1212
print("\(prefix)\(p.0) => \(p.1)", terminator: "")
13-
++i
13+
i += 1
1414
prefix = ", "
1515
}
1616
print(" (\(i) items)")
@@ -20,7 +20,7 @@ i = 0
2020
prefix = ""
2121
for p in zip(s, n) {
2222
print("\(prefix)\(p.0) => \(p.1)", terminator: "")
23-
++i
23+
i += 1
2424
prefix = ", "
2525
}
2626
print(" (\(i) items)")

test/Constraints/nested_generics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct AnyStream<T : SequenceType> {
3434
func next() -> Element? {
3535
let result = (index, elements.next())
3636
if result.1 == nil { return .None }
37-
++index
37+
index += 1
3838
return (result.0, result.1!)
3939
}
4040
}

test/DebugInfo/inout2.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ struct Struct {
2626
func foo(inout x: Class) {
2727
// CHECK: !DILocalVariable(name: "x", arg: 1{{.*}} line: [[@LINE-1]]
2828
markUsed(x.ivar)
29-
x.ivar++ // Set breakpoint here
29+
x.ivar += 1 // Set breakpoint here
3030
}
3131

3232
func foo(inout x: Struct) {
3333
// CHECK: !DILocalVariable(name: "x", arg: 1{{.*}} line: [[@LINE-1]]
3434
markUsed(x.ivar)
35-
x.ivar++ // Set breakpoint here
35+
x.ivar += 1 // Set breakpoint here
3636
}
3737

3838
func main() {

test/Generics/algorithms.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func count<R : GeneratorType where R.Element : Eq>
4141
var result = 0
4242
for x in GeneratorSequence(range) {
4343
if x == value {
44-
++result
44+
result += 1
4545
}
4646
}
4747
return result
@@ -53,7 +53,7 @@ func countIf<
5353
var result = 0
5454
for x in GeneratorSequence(range) {
5555
if predicate(x) {
56-
++result
56+
result += 1
5757
}
5858
}
5959
return result

0 commit comments

Comments
 (0)