Commit d7164a01 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Get rid of dangerous bool cast.

parent a6010356
......@@ -152,7 +152,7 @@ public:
TextEditor::CompletionItem previousItem = switchCompletionItem(0);
Symbol *previousSymbol = switchSymbol(symbol);
accept(symbol->identity());
if (_item)
if (_item.isValid())
_item.data = QVariant::fromValue(symbol);
(void) switchSymbol(previousSymbol);
return switchCompletionItem(previousItem);
......@@ -1407,7 +1407,8 @@ void CppCodeCompletion::addMacros_helper(const Snapshot &snapshot,
void CppCodeCompletion::addCompletionItem(Symbol *symbol)
{
ConvertToCompletionItem toCompletionItem(this);
if (TextEditor::CompletionItem item = toCompletionItem(symbol))
TextEditor::CompletionItem item = toCompletionItem(symbol);
if (item.isValid())
m_completions.append(item);
}
......@@ -1654,7 +1655,8 @@ bool CppCodeCompletion::completeQtMethod(const QList<LookupItem> &results,
continue;
else if (! wantSignals && ! fun->isSlot())
continue;
if (TextEditor::CompletionItem item = toCompletionItem(fun)) {
TextEditor::CompletionItem item = toCompletionItem(fun);
if (item.isValid()) {
unsigned count = fun->argumentCount();
while (true) {
TextEditor::CompletionItem ci = item;
......
......@@ -58,9 +58,6 @@ struct CompletionItem
bool isValid() const
{ return collector != 0; }
operator bool() const
{ return collector != 0; }
QString text;
QString details;
QIcon icon;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment