From a85d4e8595612ac00bfb5f34f71da3db3bf84afb Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Wed, 21 Apr 2021 22:34:09 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=20Rephrase=20as=20guard=20statemen?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MasKit/Commands/Outdated.swift | 2 +- MasKit/Network/NetworkManager.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MasKit/Commands/Outdated.swift b/MasKit/Commands/Outdated.swift index e6fe952..dbba1e7 100644 --- a/MasKit/Commands/Outdated.swift +++ b/MasKit/Commands/Outdated.swift @@ -40,7 +40,7 @@ public struct OutdatedCommand: CommandProtocol { storeSearch.lookup(app: installedApp.itemIdentifier.intValue) { storeApp, error in defer { group.leave() } - if let error = error { + guard error == nil else { // Bubble up MASErrors failure = error as? MASError ?? .searchFailed return diff --git a/MasKit/Network/NetworkManager.swift b/MasKit/Network/NetworkManager.swift index 2873d27..cb42354 100644 --- a/MasKit/Network/NetworkManager.swift +++ b/MasKit/Network/NetworkManager.swift @@ -51,14 +51,14 @@ class NetworkManager { group.wait() - if let error = error { - throw error + guard error == nil else { + throw error! } - if let data = data { - return data + guard data != nil else { + throw MASError.noData } - throw MASError.noData + return data! } }