Adopt swift-format (#2794)

* Apply formatting

* Apply no block comments rule

* Apply OmitExplicitReturns

* Apple OnlyOneTrailingClosureArgument

* Apply NoAssignmentInExpressions

* Fix up DontRepeatTypeInStaticProperties lint errors

* Apply `OrderedImports`

* Apply `ReplaceForEachWithForLoop`

* format file

* Enable the formatting pipeline

* Adopt `AmbiguousTrailingClosureOverload`

* Fix license header

* Fix format check

* Fix `EndOfLineComment`

* Fix CI

* Adapt CI script to check if changes when running formatting

* Separate lint and format into to steps

* Fix format

* Adopt `UseEarlyExits`

* Revert "Adopt `UseEarlyExits`"

This reverts commit d1ac5bbe12.
This commit is contained in:
Franz Busch authored and GitHub committed 2024-07-19 11:48:17 +02:00
1 parent 980bd3e630
commit c9756e1083
374 files changed
+23992 -14890

No files matched your search

+13 -13
View File
@@ -85,7 +85,7 @@ public struct FileSystem: Sendable, FileSystemProtocol {
let threadPool = NIOThreadPool(numberOfThreads: numberOfThreads)
threadPool.start()
// Wait for the thread pool to start.
try? await threadPool.runIfActive { }
try? await threadPool.runIfActive {}
self.init(threadPool: threadPool, ownsThreadPool: true)
}
@@ -263,7 +263,7 @@ public struct FileSystem: Sendable, FileSystemProtocol {
public func createTemporaryDirectory(
template: FilePath
) async throws -> FilePath {
return try await self.threadPool.runIfActive {
try await self.threadPool.runIfActive {
try self._createTemporaryDirectory(template: template).get()
}
}
@@ -284,7 +284,7 @@ public struct FileSystem: Sendable, FileSystemProtocol {
forFileAt path: FilePath,
infoAboutSymbolicLink: Bool
) async throws -> FileInfo? {
return try await self.threadPool.runIfActive {
try await self.threadPool.runIfActive {
try self._info(forFileAt: path, infoAboutSymbolicLink: infoAboutSymbolicLink).get()
}
}
@@ -564,7 +564,7 @@ public struct FileSystem: Sendable, FileSystemProtocol {
at linkPath: FilePath,
withDestination destinationPath: FilePath
) async throws {
return try await self.threadPool.runIfActive {
try await self.threadPool.runIfActive {
try self._createSymbolicLink(at: linkPath, withDestination: destinationPath).get()
}
}
@@ -595,7 +595,7 @@ public struct FileSystem: Sendable, FileSystemProtocol {
public func destinationOfSymbolicLink(
at path: FilePath
) async throws -> FilePath {
return try await self.threadPool.runIfActive {
try await self.threadPool.runIfActive {
try self._destinationOfSymbolicLink(at: path).get()
}
}
@@ -632,7 +632,7 @@ public struct FileSystem: Sendable, FileSystemProtocol {
get async throws {
#if canImport(Darwin)
return try await self.threadPool.runIfActive {
return try Libc.constr(_CS_DARWIN_USER_TEMP_DIR).map { path in
try Libc.constr(_CS_DARWIN_USER_TEMP_DIR).map { path in
FilePath(path)
}.mapError { errno in
FileSystemError.confstr(
@@ -694,7 +694,7 @@ extension NIOSingletons {
extension FileSystemProtocol where Self == FileSystem {
/// A global shared instance of ``FileSystem``.
public static var shared: FileSystem {
return FileSystem.shared
FileSystem.shared
}
}
@@ -719,7 +719,7 @@ extension FileSystem {
forReadingAt path: FilePath,
options: OpenOptions.Read
) -> Result<ReadFileHandle, FileSystemError> {
return SystemFileHandle.syncOpen(
SystemFileHandle.syncOpen(
atPath: path,
mode: .readOnly,
options: options.descriptorOptions,
@@ -736,7 +736,7 @@ extension FileSystem {
forWritingAt path: FilePath,
options: OpenOptions.Write
) -> Result<WriteFileHandle, FileSystemError> {
return SystemFileHandle.syncOpen(
SystemFileHandle.syncOpen(
atPath: path,
mode: .writeOnly,
options: options.descriptorOptions,
@@ -753,7 +753,7 @@ extension FileSystem {
forReadingAndWritingAt path: FilePath,
options: OpenOptions.Write
) -> Result<ReadWriteFileHandle, FileSystemError> {
return SystemFileHandle.syncOpen(
SystemFileHandle.syncOpen(
atPath: path,
mode: .readWrite,
options: options.descriptorOptions,
@@ -770,7 +770,7 @@ extension FileSystem {
at path: FilePath,
options: OpenOptions.Directory
) -> Result<DirectoryFileHandle, FileSystemError> {
return SystemFileHandle.syncOpen(
SystemFileHandle.syncOpen(
atPath: path,
mode: .readOnly,
options: options.descriptorOptions,
@@ -1001,7 +1001,7 @@ extension FileSystem {
path: FilePath,
location: FileSystemError.SourceLocation
) -> FileSystemError {
return FileSystemError(
FileSystemError(
code: .closed,
message: "Can't copy '\(sourcePath)' to '\(destinationPath)', '\(path)' is closed.",
cause: nil,
@@ -1354,7 +1354,7 @@ extension FileSystem {
at linkPath: FilePath,
withDestination destinationPath: FilePath
) -> Result<Void, FileSystemError> {
return Syscall.symlink(to: destinationPath, from: linkPath).mapError { errno in
Syscall.symlink(to: destinationPath, from: linkPath).mapError { errno in
FileSystemError.symlink(
errno: errno,
link: linkPath,