Skip to content

[Runtime] Consistent style for initializing local variables #31

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

Merged
merged 1 commit into from
Aug 1, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension Data {
extension Request {
/// Allows modifying the parsed query parameters of the request.
mutating func mutateQuery(_ closure: (inout URLComponents) throws -> Void) rethrows {
var urlComponents: URLComponents = .init()
var urlComponents = URLComponents()
if let query {
urlComponents.percentEncodedQuery = query
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Deprecated/Deprecated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ extension Request {
/// Allows modifying the parsed query parameters of the request.
@available(*, deprecated)
mutating func mutatingQuery(_ closure: (inout URLComponents) throws -> Void) rethrows {
var urlComponents: URLComponents = .init()
var urlComponents = URLComponents()
if let query {
urlComponents.percentEncodedQuery = query
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class Test_CodableExtensions: Test_Runtime {
}

var testEncoder: JSONEncoder {
let encoder: JSONEncoder = .init()
let encoder = JSONEncoder()
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
return encoder
}
Expand Down Expand Up @@ -187,7 +187,7 @@ final class Test_CodableExtensions: Test_Runtime {

struct Foo: Encodable {
var bar: String
var additionalProperties: OpenAPIObjectContainer = .init()
var additionalProperties = OpenAPIObjectContainer()

enum CodingKeys: String, CodingKey {
case bar
Expand Down
2 changes: 1 addition & 1 deletion Tests/OpenAPIRuntimeTests/Test_Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Test_Runtime: XCTestCase {
}

var testComponents: URLComponents {
var components: URLComponents = .init()
var components = URLComponents()
components.path = "/api"
return components
}
Expand Down