Remove redundant 'else' blocks

This commit is contained in:
Danny Moesch 2021-01-31 13:34:37 +01:00 committed by Mingshen Sun
parent ad4ed9419e
commit 1454693308
9 changed files with 22 additions and 57 deletions

View file

@ -25,11 +25,7 @@ class PasswordsTableDataSource: NSObject, UITableViewDataSource {
}
func numberOfSections(in _: UITableView) -> Int {
if !showSuggestion {
return 1
} else {
return 2
}
!showSuggestion ? 1 : 2
}
func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
@ -40,16 +36,13 @@ class PasswordsTableDataSource: NSObject, UITableViewDataSource {
if suggestedPasswordsTableEntries.isEmpty {
return nil
}
if !showSuggestion {
return "All Passwords"
}
if section == 0 {
return "Suggested Passwords"
} else {
return "Other Passwords"
}
return "Other Passwords"
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@ -97,11 +90,9 @@ class PasswordsTableDataSource: NSObject, UITableViewDataSource {
if showSuggestion {
if section == 0 {
return suggestedPasswordsTableEntries
} else {
return otherPasswordsTableEntries
}
} else {
return filteredPasswordsTableEntries
return otherPasswordsTableEntries
}
return filteredPasswordsTableEntries
}
}