Skip to content

Enable some nice-to-have code formatting rules #3110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .swift-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"NoBlockComments": false,
"OrderedImports": true,
"UseLetInEveryBoundCaseVariable": false,
"UseSynthesizedInitializer": false
"UseSynthesizedInitializer": false,
"ReturnVoidInsteadOfEmptyTuple": true,
"NoVoidReturnOnFunctionSignature": true,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ func runPeerMacrosPlayground() {

struct MyStruct {
@AddAsync
func c(a: Int, for b: String, _ value: Double, completionBlock: @escaping (Result<String, Error>) -> Void) -> Void {
func c(a: Int, for b: String, _ value: Double, completionBlock: @escaping (Result<String, Error>) -> Void) {
completionBlock(.success("a: \(a), b: \(b), value: \(value)"))
}

@AddAsync
func d(a: Int, for b: String, _ value: Double, completionBlock: @escaping (Bool) -> Void) -> Void {
func d(a: Int, for b: String, _ value: Double, completionBlock: @escaping (Bool) -> Void) {
completionBlock(true)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftParser/IncrementalParseTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension Parser {
///
/// This is also used for testing purposes to ensure incremental reparsing
/// worked as expected.
public typealias ReusedNodeCallback = (_ node: Syntax) -> ()
public typealias ReusedNodeCallback = (_ node: Syntax) -> Void

/// Keeps track of a previously parsed syntax tree and the source edits that
/// occurred since it was created.
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftSyntax/SourceLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ fileprivate extension SyntaxText {
/// - Returns: The position at the end of the walk.
func forEachEndOfLine(
position: AbsolutePosition,
body: (AbsolutePosition) -> ()
body: (AbsolutePosition) -> Void
) -> AbsolutePosition {
guard let startPtr = buffer.baseAddress else {
return position
Expand Down Expand Up @@ -745,7 +745,7 @@ fileprivate extension RawTriviaPiece {
/// - Returns: The position at the end of the walk.
func forEachEndOfLine(
position: AbsolutePosition,
body: (AbsolutePosition) -> ()
body: (AbsolutePosition) -> Void
) -> AbsolutePosition {
var position = position
switch self {
Expand Down Expand Up @@ -788,7 +788,7 @@ fileprivate extension RawTriviaPieceBuffer {
/// - Returns: The position at the end of the walk.
func forEachEndOfLine(
position: AbsolutePosition,
body: (AbsolutePosition) -> ()
body: (AbsolutePosition) -> Void
) -> AbsolutePosition {
var position = position
for piece in self {
Expand All @@ -810,8 +810,8 @@ fileprivate extension RawSyntax {
/// - Returns: The position at the end of the walk.
func forEachEndOfLine(
position: AbsolutePosition,
body: (AbsolutePosition) -> (),
handleSourceLocationDirective: (_ position: AbsolutePosition, _ rawSyntax: RawSyntax) -> ()
body: (AbsolutePosition) -> Void,
handleSourceLocationDirective: (_ position: AbsolutePosition, _ rawSyntax: RawSyntax) -> Void
) -> AbsolutePosition {
var position = position
switch self.rawData.payload {
Expand Down
Loading