-
Notifications
You must be signed in to change notification settings - Fork 648
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
fix Swift 5 warnings (mostly redundant modifiers) #642
Conversation
spurious fail
|
@swift-nio-bot test this please |
Ugh I hate this warning too. What does it achieve beyond forcing people to put the access modifier doc page in their bookmarks? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically looks good, but it'd be nice to fix up some indentation briefly.
@@ -54,7 +54,7 @@ public extension ChannelPipeline { | |||
/// complete. | |||
/// - returns: An `EventLoopFuture` that will fire when the pipeline is configured. | |||
@available(*, deprecated, message: "Please use configureHTTPServerPipeline") | |||
public func addHTTPServerHandlersWithUpgrader(first: Bool = false, | |||
func addHTTPServerHandlersWithUpgrader(first: Bool = false, | |||
upgraders: [HTTPProtocolUpgrader], | |||
_ upgradeCompletionHandler: @escaping (ChannelHandlerContext) -> Void) -> EventLoopFuture<Void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind fixing up the indentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, thanks!
@@ -93,7 +93,7 @@ public extension ChannelPipeline { | |||
/// failure to parse the HTTP request) by sending 400 errors. Defaults to `false` for | |||
/// backward-compatibility reasons. | |||
/// - returns: An `EventLoopFuture` that will fire when the pipeline is configured. | |||
public func configureHTTPServerPipeline(first: Bool = false, | |||
func configureHTTPServerPipeline(first: Bool = false, | |||
withPipeliningAssistance pipelining: Bool = true, | |||
withServerUpgrade upgrade: HTTPUpgradeConfiguration? = nil, | |||
withErrorHandling errorHandling: Bool = false) -> EventLoopFuture<Void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation here too please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all done, thanks!
8632831
to
2ef0ced
Compare
Motivation: Swift 5 complains on redundant modifiers. For example declaring a `public func` inside of a `public extension` is now a warning. I don't agree with this but I dislike warnings even more, so... Modifications: remove all redundant modifiers that the compiler now warns about such as swift-nio/Sources/NIOPriorityQueue/PriorityQueue.swift:90:5: warning: 'public' modifier is redundant for property declared in a public extension Result: no warnings in Swift 5
2ef0ced
to
587161a
Compare
Seems like you hit a spurious failure again. |
@swift-nio-bot test this please |
defer { | ||
// fr2's underlying fd must be closed by us. | ||
XCTAssertNoThrow(try fh2.close()) | ||
} | ||
|
||
XCTAssertEqual(Array("01234".utf8), fr1Bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weissi any reason why this was moved ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@normanmaurer yes, previously it didn't actually do anything in case of an error thrown. defer
s are only executed on errors if the defer
is syntactically before the error thrown. So generally cleanup-defer
s need to go straight after the resource creation.
The previous one raised a warning in Swift 5
@swift-nio-bot test this please |
Motivation:
Swift 5 complains on redundant modifiers. For example declaring a
public func
inside of apublic extension
is now a warning. I don'tagree with this but I dislike warnings even more, so...
Modifications:
remove all redundant modifiers that the compiler now warns about such as
Result:
no warnings in Swift 5