Skip to content

Commit 6dc78d6

Browse files
authored
Merge pull request kodecocodes#451 from jawwad/swiftlint-fixes
Swiftlint fixes
2 parents 63baead + 71c0e32 commit 6dc78d6

File tree

41 files changed

+58
-76
lines changed

Some content is hidden

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

41 files changed

+58
-76
lines changed

All-Pairs Shortest Paths/APSP/APSP/FloydWarshall.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public struct FloydWarshallResult<T>: APSPResult where T: Hashable {
175175
public func path(fromVertex from: Vertex<T>, toVertex to: Vertex<T>, inGraph graph: AbstractGraph<T>) -> [T]? {
176176

177177
if let path = recursePathFrom(fromVertex: from, toVertex: to, path: [ to ], inGraph: graph) {
178-
let pathValues = path.map() { vertex in
178+
let pathValues = path.map { vertex in
179179
vertex.data
180180
}
181181
return pathValues

B-Tree/BTree.playground/Contents.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ bTree[3]
1414

1515
bTree.remove(2)
1616

17-
bTree.traverseKeysInOrder {
18-
key in
17+
bTree.traverseKeysInOrder { key in
1918
print(key)
2019
}
2120

B-Tree/Tests/Tests/BTreeNodeTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,3 @@ class BTreeNodeTests: XCTestCase {
5151
XCTAssertEqual(root.children!.count, 2)
5252
}
5353
}
54-

Bloom Filter/BloomFilter.playground/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class BloomFilter<T> {
1010
}
1111

1212
private func computeHashes(_ value: T) -> [Int] {
13-
return hashFunctions.map() { hashFunc in abs(hashFunc(value) % array.count) }
13+
return hashFunctions.map { hashFunc in abs(hashFunc(value) % array.count) }
1414
}
1515

1616
public func insert(_ element: T) {
@@ -29,7 +29,7 @@ public class BloomFilter<T> {
2929
let hashValues = computeHashes(value)
3030

3131
// Map hashes to indices in the Bloom Filter
32-
let results = hashValues.map() { hashValue in array[hashValue] }
32+
let results = hashValues.map { hashValue in array[hashValue] }
3333

3434
// All values must be 'true' for the query to return true
3535

Bloom Filter/BloomFilter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class BloomFilter<T> {
88
}
99

1010
private func computeHashes(_ value: T) -> [Int] {
11-
return hashFunctions.map() { hashFunc in abs(hashFunc(value) % array.count) }
11+
return hashFunctions.map { hashFunc in abs(hashFunc(value) % array.count) }
1212
}
1313

1414
public func insert(_ element: T) {
@@ -27,7 +27,7 @@ public class BloomFilter<T> {
2727
let hashValues = computeHashes(value)
2828

2929
// Map hashes to indices in the Bloom Filter
30-
let results = hashValues.map() { hashValue in array[hashValue] }
30+
let results = hashValues.map { hashValue in array[hashValue] }
3131

3232
// All values must be 'true' for the query to return true
3333

Brute-Force String Search/BruteForceStringSearch.playground/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension String {
66
for i in self.characters.indices {
77
var j = i
88
var found = true
9-
for p in pattern.characters.indices{
9+
for p in pattern.characters.indices {
1010
if j == self.characters.endIndex || self[j] != pattern[p] {
1111
found = false
1212
break

Brute-Force String Search/BruteForceStringSearch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension String {
66
for i in self.characters.indices {
77
var j = i
88
var found = true
9-
for p in pattern.characters.indices{
9+
for p in pattern.characters.indices {
1010
if j == self.characters.endIndex || self[j] != pattern[p] {
1111
found = false
1212
break

Bucket Sort/BucketSort.playground/Sources/BucketSort.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public struct InsertionSorter: Sorter {
122122
// MARK: Bucket
123123
//////////////////////////////////////
124124

125-
public struct Bucket<T:Sortable> {
125+
public struct Bucket<T: Sortable> {
126126
var elements: [T]
127127
let capacity: Int
128128

Bucket Sort/BucketSort.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public struct InsertionSorter: Sorter {
173173
// MARK: Bucket
174174
//////////////////////////////////////
175175

176-
public struct Bucket<T:Sortable> {
176+
public struct Bucket<T: Sortable> {
177177
var elements: [T]
178178
let capacity: Int
179179

Comb Sort/Comb Sort.playground/Contents.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ while i < 1000 {
1616
i += 1
1717
}
1818
combSort(bigArray)
19-
20-

0 commit comments

Comments
 (0)