lint: empty if statement

This commit is contained in:
Kurtis Rader 2016-11-01 20:42:02 -07:00
parent 60c47deca9
commit 71e69b6d75
8 changed files with 17 additions and 20 deletions

View file

@ -287,11 +287,10 @@ std::string wcs2string(const wcstring &input) {
for (size_t i = 0; i < input.size(); i++) {
wchar_t wc = input[i];
if (wc == INTERNAL_SEPARATOR) {
// Do nothing.
; // do nothing
} else if (wc >= ENCODE_DIRECT_BASE && wc < ENCODE_DIRECT_BASE + 256) {
result.push_back(wc - ENCODE_DIRECT_BASE);
} else if (MB_CUR_MAX == 1) // single-byte locale (C/POSIX/ISO-8859)
{
} else if (MB_CUR_MAX == 1) { // single-byte locale (C/POSIX/ISO-8859)
// If `wc` contains a wide character we emit a question-mark.
if (wc & ~0xFF) {
wc = '?';
@ -328,7 +327,7 @@ static char *wcs2str_internal(const wchar_t *in, char *out) {
while (in[in_pos]) {
if (in[in_pos] == INTERNAL_SEPARATOR) {
// Do nothing.
; // do nothing
} else if (in[in_pos] >= ENCODE_DIRECT_BASE && in[in_pos] < ENCODE_DIRECT_BASE + 256) {
out[out_pos++] = in[in_pos] - ENCODE_DIRECT_BASE;
} else if (MB_CUR_MAX == 1) // single-byte locale (C/POSIX/ISO-8859)

View file

@ -679,11 +679,11 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool
}
}
// WTF? This seems to be a noop.
if (use_implicit_cd &&
!expand_string(str_cmd, &this->completions,
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL)) {
// Not valid as implicit cd.
if (use_implicit_cd) {
// We don't really care if this succeeds or fails. If it succeeds this->completions will be
// updated with choices for the user.
(void)expand_string(str_cmd, &this->completions,
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL);
}
if (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~') {

View file

@ -979,11 +979,8 @@ wcstring get_machine_identifier() {
for (size_t i = 0; i < MAC_ADDRESS_MAX_LEN; i++) {
append_format(result, L"%02x", mac_addr[i]);
}
} else if (get_hostname_identifier(&result)) {
// Hooray
} else {
// Fallback
result.assign(L"nohost");
} else if (!get_hostname_identifier(&result)) {
result.assign(L"nohost"); // fallback to a dummy value
}
return result;
}

View file

@ -1386,7 +1386,7 @@ static expand_error_t expand_stage_wildcards(const wcstring &input, std::vector<
const bool has_wildcard = wildcard_has(path_to_expand, true /* internal, i.e. ANY_CHAR */);
if (has_wildcard && (flags & EXECUTABLES_ONLY)) {
// Don't do wildcard expansion for executables. See #785. Make them expand to nothing here.
; // don't do wildcard expansion for executables, see issue #785
} else if (((flags & EXPAND_FOR_COMPLETIONS) && (!(flags & EXPAND_SKIP_WILDCARDS))) ||
has_wildcard) {
// We either have a wildcard, or we don't have a wildcard but we're doing completion

View file

@ -988,7 +988,7 @@ bool parse_ll_t::top_node_handle_terminal_types(parse_token_t token) {
} else if (stack_top.keyword == parse_keyword_end &&
token.type == parse_token_type_terminate &&
this->report_error_for_unclosed_block()) {
// Handled by report_error_for_unclosed_block.
; // handled by report_error_for_unclosed_block
} else {
const wcstring expected = stack_top.user_presentable_description();
this->parse_error_unexpected_token(expected.c_str(), token);

View file

@ -336,10 +336,13 @@ static void handle_child_status(pid_t pid, int status) {
}
}
#if 0
// TODO: decide whether to eliminate this block or have it emit a warning message.
if (!found_proc) {
// A child we lost track of? There have been bugs in both subshell handling and in builtin
// handling that have caused this previously...
}
#endif
return;
}

View file

@ -2205,7 +2205,7 @@ static void reader_super_highlight_me_plenty(int match_highlight_pos_adjust, boo
const wcstring &cmd = el->text, &suggest = data->autosuggestion;
if (can_autosuggest() && !suggest.empty() &&
string_prefixes_string_case_insensitive(cmd, suggest)) {
// The autosuggestion is still reasonable, so do nothing.
; // the autosuggestion is still reasonable, so do nothing
} else {
update_autosuggestion();
}

View file

@ -385,9 +385,7 @@ static bool wildcard_test_flags_then_complete(const wcstring &filepath, const wc
int stat_res = -1;
int stat_errno = 0;
int lstat_res = lwstat(filepath, &lstat_buf);
if (lstat_res < 0) {
// lstat failed.
} else {
if (lstat_res >= 0) {
if (S_ISLNK(lstat_buf.st_mode)) {
stat_res = wstat(filepath, &stat_buf);