Skip to content

Commit

Permalink
Remove unnecessary else block within when statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sabercodic committed Dec 4, 2023
1 parent d4ed3bf commit fd3ecd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ class VoucherDialogViewModel(
when (val result = serviceConnectionManager.voucherRedeemer()?.submit(voucherCode)) {
is VoucherSubmissionResult.Ok -> handleAddedTime(result.submission.timeAdded)
is VoucherSubmissionResult.Error -> setError(result.error)
else -> {
vmState.update { VoucherDialogState.Default }
}
null -> vmState.update { VoucherDialogState.Default }
}
}
}
Expand All @@ -88,7 +86,8 @@ class VoucherDialogViewModel(
when (error) {
VoucherSubmissionError.InvalidVoucher -> R.string.invalid_voucher
VoucherSubmissionError.VoucherAlreadyUsed -> R.string.voucher_already_used
else -> R.string.error_occurred
VoucherSubmissionError.RpcError,
VoucherSubmissionError.OtherError -> R.string.error_occurred
}
)
vmState.update { VoucherDialogState.Error(message) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class SplitTunnelingPersistence(context: Context) {
}

private fun loadExcludedApps(): Set<String> {
return when {
appListFile.exists() -> appListFile.readLines().toSet()
else -> emptySet()
}
return if (appListFile.exists()) appListFile.readLines().toSet() else emptySet()
}
}

0 comments on commit fd3ecd6

Please sign in to comment.