diff --git a/.swiftlint.yml b/.swiftlint.yml index 3a07daa9eb53..eb101bcaf4f6 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -10,6 +10,9 @@ included: # Rules – Opt-in only, so we can progressively introduce new ones # only_rules: + # Prefer `Array(xs)` over `xs.map { $0 }`. + - array_init + # Colons should be next to the identifier when specifying a type. - colon diff --git a/Modules/Sources/WordPressKit/BlockEditorSettingsServiceRemote.swift b/Modules/Sources/WordPressKit/BlockEditorSettingsServiceRemote.swift index d8ddd37d6613..45da7102bec1 100644 --- a/Modules/Sources/WordPressKit/BlockEditorSettingsServiceRemote.swift +++ b/Modules/Sources/WordPressKit/BlockEditorSettingsServiceRemote.swift @@ -31,7 +31,7 @@ public extension BlockEditorSettingsServiceRemote { func fetchBlockEditorSettings(completion: @escaping BlockEditorSettingsCompletionHandler) { Task { @MainActor in let result = await self.remoteAPI.get(path: "/wp-block-editor/v1/settings", parameters: ["context": "mobile"], type: RemoteBlockEditorSettings.self) - .map { settings -> RemoteBlockEditorSettings? in settings } + .map(Optional.some) .flatMapError { original in if case let .unparsableResponse(response, _, underlyingError) = original, response?.statusCode == 200, underlyingError is DecodingError { return .success(nil)