forked from qt-creator/qt-creator
Fix occurrences of the contains/insert anti-pattern
Introduce and make use of Utils::insert() for QSet with a return value that indicates whether insertion actually happened. Change-Id: I655e4bc3553b74fea5ae8956205e4d8070118d63 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -269,11 +269,9 @@ void GlslEditorWidget::updateDocumentNow()
|
||||
for (const DiagnosticMessage &m : messages) {
|
||||
if (! m.line())
|
||||
continue;
|
||||
else if (errors.contains(m.line()))
|
||||
if (!Utils::insert(errors, m.line()))
|
||||
continue;
|
||||
|
||||
errors.insert(m.line());
|
||||
|
||||
QTextCursor cursor(document()->findBlockByNumber(m.line() - 1));
|
||||
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user