diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2023-06-22 14:58:11 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-06-23 09:51:54 +0000 |
commit | cf6bd7e0124f31374f3a4abd05d14199d201961b (patch) | |
tree | 90ce2081bdea0b7bece256bd00c0d0476171e00f /src/plugins/cppeditor/cppquickfixes.cpp | |
parent | ae33199d046902bb9877810df2dbc590b083ef3c (diff) |
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>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfixes.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppquickfixes.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index a7134169d6..77672a8569 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -8342,14 +8342,13 @@ private: QList<Snapshot::IncludeLocation> includeLocationsOfDocument = refactoring.snapshot().includeLocationsOfDocument(filePath); for (Snapshot::IncludeLocation &loc : includeLocationsOfDocument) { - if (m_processed.contains(loc.first)) + if (!Utils::insert(m_processed, loc.first)) continue; CppRefactoringFilePtr file = refactoring.file(loc.first->filePath()); const bool noGlobalUsing = refactorFile(file, refactoring.snapshot(), file->position(loc.second, 1)); - m_processed.insert(loc.first); if (noGlobalUsing) processIncludes(refactoring, loc.first->filePath()); } |