Fix lint warnings

This commit is contained in:
Christian Treffs 2020-08-03 11:21:48 +02:00
parent 64c7b16764
commit 48c617266c
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
2 changed files with 13 additions and 7 deletions

View File

@ -10,7 +10,7 @@ private struct FamilyMemberContainer<R> where R: FamilyRequirementsManaging {
}
extension CodingUserInfoKey {
fileprivate static let nexusCodingStrategy = CodingUserInfoKey(rawValue: "nexusCodingStrategy").unsafelyUnwrapped
static let nexusCodingStrategy = CodingUserInfoKey(rawValue: "nexusCodingStrategy").unsafelyUnwrapped
}
// MARK: - encoding
@ -43,7 +43,7 @@ extension Family where R: FamilyEncoding {
/// - Returns: The encoded data.
public func encodeMembers<Encoder>(using encoder: inout Encoder) throws -> Encoder.Output where Encoder: TopLevelEncoder {
encoder.userInfo[.nexusCodingStrategy] = nexus.codingStrategy
let components: [R.Components] = self.map { $0 }
let components = [R.Components](self)
let container = FamilyMemberContainer<R>(components: components)
return try encoder.encode(container)
}

View File

@ -13,15 +13,20 @@
///
/// See <https://github.com/bombela/sparseset/blob/master/src/lib.rs> for a reference implementation.
public struct UnorderedSparseSet<Element, Key: Hashable & Codable> {
@usableFromInline final class Storage {
// swiftlint:disable nesting
@usableFromInline
final class Storage {
/// An index into the dense store.
public typealias DenseIndex = Int
@usableFromInline
typealias DenseIndex = Int
/// A sparse store holding indices into the dense mapped to key.
public typealias SparseStore = [Key: DenseIndex]
@usableFromInline
typealias SparseStore = [Key: DenseIndex]
/// A dense store holding all the entries.
public typealias DenseStore = ContiguousArray<Entry>
@usableFromInline
typealias DenseStore = ContiguousArray<Entry>
@usableFromInline
struct Entry {
@ -122,7 +127,8 @@ public struct UnorderedSparseSet<Element, Key: Hashable & Codable> {
dense.removeAll(keepingCapacity: keepingCapacity)
}
@inlinable func makeIterator() -> IndexingIterator<ContiguousArray<Storage.Entry>> {
@inlinable
func makeIterator() -> IndexingIterator<ContiguousArray<Storage.Entry>> {
dense.makeIterator()
}
}