mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00:00
lint: empty if statement
This commit is contained in:
parent
60c47deca9
commit
71e69b6d75
8 changed files with 17 additions and 20 deletions
|
@ -287,11 +287,10 @@ std::string wcs2string(const wcstring &input) {
|
||||||
for (size_t i = 0; i < input.size(); i++) {
|
for (size_t i = 0; i < input.size(); i++) {
|
||||||
wchar_t wc = input[i];
|
wchar_t wc = input[i];
|
||||||
if (wc == INTERNAL_SEPARATOR) {
|
if (wc == INTERNAL_SEPARATOR) {
|
||||||
// Do nothing.
|
; // do nothing
|
||||||
} else if (wc >= ENCODE_DIRECT_BASE && wc < ENCODE_DIRECT_BASE + 256) {
|
} else if (wc >= ENCODE_DIRECT_BASE && wc < ENCODE_DIRECT_BASE + 256) {
|
||||||
result.push_back(wc - ENCODE_DIRECT_BASE);
|
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` contains a wide character we emit a question-mark.
|
||||||
if (wc & ~0xFF) {
|
if (wc & ~0xFF) {
|
||||||
wc = '?';
|
wc = '?';
|
||||||
|
@ -328,7 +327,7 @@ static char *wcs2str_internal(const wchar_t *in, char *out) {
|
||||||
|
|
||||||
while (in[in_pos]) {
|
while (in[in_pos]) {
|
||||||
if (in[in_pos] == INTERNAL_SEPARATOR) {
|
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) {
|
} else if (in[in_pos] >= ENCODE_DIRECT_BASE && in[in_pos] < ENCODE_DIRECT_BASE + 256) {
|
||||||
out[out_pos++] = in[in_pos] - ENCODE_DIRECT_BASE;
|
out[out_pos++] = in[in_pos] - 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)
|
||||||
|
|
|
@ -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) {
|
||||||
if (use_implicit_cd &&
|
// We don't really care if this succeeds or fails. If it succeeds this->completions will be
|
||||||
!expand_string(str_cmd, &this->completions,
|
// updated with choices for the user.
|
||||||
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL)) {
|
(void)expand_string(str_cmd, &this->completions,
|
||||||
// Not valid as implicit cd.
|
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~') {
|
if (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~') {
|
||||||
|
|
|
@ -979,11 +979,8 @@ wcstring get_machine_identifier() {
|
||||||
for (size_t i = 0; i < MAC_ADDRESS_MAX_LEN; i++) {
|
for (size_t i = 0; i < MAC_ADDRESS_MAX_LEN; i++) {
|
||||||
append_format(result, L"%02x", mac_addr[i]);
|
append_format(result, L"%02x", mac_addr[i]);
|
||||||
}
|
}
|
||||||
} else if (get_hostname_identifier(&result)) {
|
} else if (!get_hostname_identifier(&result)) {
|
||||||
// Hooray
|
result.assign(L"nohost"); // fallback to a dummy value
|
||||||
} else {
|
|
||||||
// Fallback
|
|
||||||
result.assign(L"nohost");
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 */);
|
const bool has_wildcard = wildcard_has(path_to_expand, true /* internal, i.e. ANY_CHAR */);
|
||||||
|
|
||||||
if (has_wildcard && (flags & EXECUTABLES_ONLY)) {
|
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))) ||
|
} else if (((flags & EXPAND_FOR_COMPLETIONS) && (!(flags & EXPAND_SKIP_WILDCARDS))) ||
|
||||||
has_wildcard) {
|
has_wildcard) {
|
||||||
// We either have a wildcard, or we don't have a wildcard but we're doing completion
|
// We either have a wildcard, or we don't have a wildcard but we're doing completion
|
||||||
|
|
|
@ -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 &&
|
} else if (stack_top.keyword == parse_keyword_end &&
|
||||||
token.type == parse_token_type_terminate &&
|
token.type == parse_token_type_terminate &&
|
||||||
this->report_error_for_unclosed_block()) {
|
this->report_error_for_unclosed_block()) {
|
||||||
// Handled by report_error_for_unclosed_block.
|
; // handled by report_error_for_unclosed_block
|
||||||
} else {
|
} else {
|
||||||
const wcstring expected = stack_top.user_presentable_description();
|
const wcstring expected = stack_top.user_presentable_description();
|
||||||
this->parse_error_unexpected_token(expected.c_str(), token);
|
this->parse_error_unexpected_token(expected.c_str(), token);
|
||||||
|
|
|
@ -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) {
|
if (!found_proc) {
|
||||||
// A child we lost track of? There have been bugs in both subshell handling and in builtin
|
// A child we lost track of? There have been bugs in both subshell handling and in builtin
|
||||||
// handling that have caused this previously...
|
// handling that have caused this previously...
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
const wcstring &cmd = el->text, &suggest = data->autosuggestion;
|
||||||
if (can_autosuggest() && !suggest.empty() &&
|
if (can_autosuggest() && !suggest.empty() &&
|
||||||
string_prefixes_string_case_insensitive(cmd, suggest)) {
|
string_prefixes_string_case_insensitive(cmd, suggest)) {
|
||||||
// The autosuggestion is still reasonable, so do nothing.
|
; // the autosuggestion is still reasonable, so do nothing
|
||||||
} else {
|
} else {
|
||||||
update_autosuggestion();
|
update_autosuggestion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,9 +385,7 @@ static bool wildcard_test_flags_then_complete(const wcstring &filepath, const wc
|
||||||
int stat_res = -1;
|
int stat_res = -1;
|
||||||
int stat_errno = 0;
|
int stat_errno = 0;
|
||||||
int lstat_res = lwstat(filepath, &lstat_buf);
|
int lstat_res = lwstat(filepath, &lstat_buf);
|
||||||
if (lstat_res < 0) {
|
if (lstat_res >= 0) {
|
||||||
// lstat failed.
|
|
||||||
} else {
|
|
||||||
if (S_ISLNK(lstat_buf.st_mode)) {
|
if (S_ISLNK(lstat_buf.st_mode)) {
|
||||||
stat_res = wstat(filepath, &stat_buf);
|
stat_res = wstat(filepath, &stat_buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue