From 4e505efc508248bf77a7bbf9193d5ed784d61115 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Thu, 3 Nov 2016 16:32:27 -0700 Subject: [PATCH] lint: redundant if statement --- src/highlight.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/highlight.cpp b/src/highlight.cpp index 260a8cac4..6033de4d4 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -337,17 +337,10 @@ bool autosuggest_validate_from_history(const history_item_t &item, handled = true; bool is_help = string_prefixes_string(dir, L"--help") || string_prefixes_string(dir, L"-h"); - if (is_help) { - suggestionOK = false; - } else { + if (!is_help) { wcstring path; bool can_cd = path_get_cdpath(dir, &path, working_directory.c_str(), vars); - if (!can_cd) { - suggestionOK = false; - } else if (paths_are_same_file(working_directory, path)) { - // Don't suggest the working directory as the path! - suggestionOK = false; - } else { + if (can_cd && !paths_are_same_file(working_directory, path)) { suggestionOK = true; } }