aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/complete.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-04 15:19:47 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-04 15:32:04 -0700
commit79f342b954a6f47ee3f1277a899066a654e7c330 (patch)
treea9386ce1e108a5c046276e4266e0129404fc4ea0 /src/complete.cpp
parent527e5f52ba5a097a24490065fea23b4627032e4c (diff)
lint cleanup: eliminate "redundant" errors
This removes some pointless parentheses but the primary focus is removing redundancies like unnecessary "else" clauses.
Diffstat (limited to 'src/complete.cpp')
-rw-r--r--src/complete.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/complete.cpp b/src/complete.cpp
index 198ad2e3..ef713bb8 100644
--- a/src/complete.cpp
+++ b/src/complete.cpp
@@ -71,9 +71,8 @@ void complete_set_variable_names(const wcstring_list_t *names) {
static inline wcstring_list_t complete_get_variable_names(void) {
if (s_override_variable_names != NULL) {
return *s_override_variable_names;
- } else {
- return env_get_names(0);
}
+ return env_get_names(0);
}
/// Struct describing a completion option entry.
@@ -161,9 +160,8 @@ struct completion_entry_set_comparer {
// Paths always come last for no particular reason.
if (p1.cmd_is_path != p2.cmd_is_path) {
return p1.cmd_is_path < p2.cmd_is_path;
- } else {
- return p1.cmd < p2.cmd;
}
+ return p1.cmd < p2.cmd;
}
};
typedef std::set<completion_entry_t, completion_entry_set_comparer> completion_entry_set_t;
@@ -285,8 +283,7 @@ class completer_t {
enum complete_type_t { COMPLETE_DEFAULT, COMPLETE_AUTOSUGGEST };
complete_type_t type() const {
- return (flags & COMPLETION_REQUEST_AUTOSUGGESTION) ? COMPLETE_AUTOSUGGEST
- : COMPLETE_DEFAULT;
+ return flags & COMPLETION_REQUEST_AUTOSUGGESTION ? COMPLETE_AUTOSUGGEST : COMPLETE_DEFAULT;
}
bool wants_descriptions() const { return !!(flags & COMPLETION_REQUEST_DESCRIPTIONS); }
@@ -295,8 +292,8 @@ class completer_t {
fuzzy_match_type_t max_fuzzy_match_type() const {
// If we are doing fuzzy matching, request all types; if not request only prefix matching.
- return (flags & COMPLETION_REQUEST_FUZZY_MATCH) ? fuzzy_match_none
- : fuzzy_match_prefix_case_insensitive;
+ if (flags & COMPLETION_REQUEST_FUZZY_MATCH) return fuzzy_match_none;
+ return fuzzy_match_prefix_case_insensitive;
}
public:
@@ -1313,7 +1310,7 @@ void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *out_c
tree.get_child(*plain_statement, 0, parse_token_type_string);
// Get the actual command string.
- if (cmd_node != NULL) current_command = cmd_node->get_source(cmd);
+ if (cmd_node) current_command = cmd_node->get_source(cmd);
// Check the decoration.
switch (tree.decoration_for_plain_statement(*plain_statement)) {
@@ -1341,7 +1338,7 @@ void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *out_c
}
}
- if (cmd_node && cmd_node->location_in_or_at_end_of_source_range(pos)) {
+ if (cmd_node && cmd_node->location_in_or_at_end_of_source_range(pos)) {
// Complete command filename.
completer.complete_cmd(current_token, use_function, use_builtin, use_command,
use_implicit_cd);