From 5608a8f79cb8a0ea0e044f20f75ab51fdf850046 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Tue, 23 Aug 2022 05:51:08 -0400 Subject: [PATCH] && is already short-circuit evaluation abusing ? : seems unnecessary if m_stops empty -> just return false then try find -> judge if the term can be found (result of find is not the end of m_stops) --- src/rcldb/stoplist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rcldb/stoplist.cpp b/src/rcldb/stoplist.cpp index e603441b..6f0b46fc 100644 --- a/src/rcldb/stoplist.cpp +++ b/src/rcldb/stoplist.cpp @@ -50,7 +50,7 @@ bool StopList::setFile(const string &filename) // faster than find() in this case. bool StopList::isStop(const string &term) const { - return m_stops.empty() ? false : m_stops.find(term) != m_stops.end(); + return !m_stops.empty() && m_stops.find(term) != m_stops.end(); } }