From edb44b1fd3440467006817328f1a62771f8c7d2f Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 20 Feb 2020 12:42:34 +0100 Subject: [PATCH] Enable clazy connect-3arg-lambda --- .gitlab-ci.yml | 2 +- autotests/formattest.cpp | 2 +- autotests/parttest.cpp | 8 ++++---- ui/pageview.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b36418cce..bf41027c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,7 +48,7 @@ build_clazy_clang_tidy: script: - srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json - - CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot" ninja + - CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot,connect-3arg-lambda" ninja # Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later - sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h - "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\"" diff --git a/autotests/formattest.cpp b/autotests/formattest.cpp index 1f923cf94..0ab9b5aa4 100644 --- a/autotests/formattest.cpp +++ b/autotests/formattest.cpp @@ -56,7 +56,7 @@ void FormatTest::initTestCase() const QMimeType mime = db.mimeTypeForFile( testFile ); QCOMPARE( m_document->openDocument( testFile, QUrl(), mime), Okular::Document::OpenSuccess ); - connect( m_document, &Okular::Document::refreshFormWidget, [=]( Okular::FormField * form ) + connect( m_document, &Okular::Document::refreshFormWidget, this, [this]( Okular::FormField * form ) { Okular::FormFieldText *fft = reinterpret_cast< Okular::FormFieldText * >( form ); if( fft ) diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp index 0067eb309..9c0598cfa 100644 --- a/autotests/parttest.cpp +++ b/autotests/parttest.cpp @@ -515,7 +515,7 @@ void PartTest::testRClickWhileLinkTextIsSelected() // the menu disappear PageView *view = part.m_pageView; bool menuClosed = false; - QTimer::singleShot(2000, [view, &menuClosed]() { + QTimer::singleShot(2000, view, [view, &menuClosed]() { // check if popup menu is active and visible QMenu *menu = qobject_cast(view->findChild(QStringLiteral("PopupMenu"))); QVERIFY(menu); @@ -584,7 +584,7 @@ void PartTest::testRClickOverLinkWhileLinkTextIsSelected() // the menu disappear PageView *view = part.m_pageView; bool menuClosed = false; - QTimer::singleShot(2000, [view, &menuClosed]() { + QTimer::singleShot(2000, view, [view, &menuClosed]() { // check if popup menu is active and visible QMenu *menu = qobject_cast(view->findChild(QStringLiteral("PopupMenu"))); QVERIFY(menu); @@ -641,7 +641,7 @@ void PartTest::testRClickOnSelectionModeShoulShowFollowTheLinkMenu() // the menu disappear PageView *view = part.m_pageView; bool menuClosed = false; - QTimer::singleShot(2000, [view, &menuClosed]() { + QTimer::singleShot(2000, view, [view, &menuClosed]() { // check if popup menu is active and visible QMenu *menu = qobject_cast(view->findChild(QStringLiteral("PopupMenu"))); QVERIFY(menu); @@ -745,7 +745,7 @@ void PartTest::testeRectSelectionStartingOnLinks() // the menu disappear PageView *view = part.m_pageView; bool menuClosed = false; - QTimer::singleShot(2000, [view, &menuClosed]() { + QTimer::singleShot(2000, view, [view, &menuClosed]() { QApplication::clipboard()->clear(); // check if popup menu is active and visible diff --git a/ui/pageview.cpp b/ui/pageview.cpp index e5ed65871..fbaf2bcf1 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -4599,7 +4599,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo { QAction * actCopyLinkLocation = menu->addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Link Address" ) ); actCopyLinkLocation->setObjectName(QStringLiteral("CopyLinkLocationAction")); - connect( actCopyLinkLocation, &QAction::triggered, [ link ]() { + connect( actCopyLinkLocation, &QAction::triggered, menu, [ link ]() { const Okular::BrowseAction * browseLink = static_cast< const Okular::BrowseAction * >( link ); QClipboard *cb = QApplication::clipboard(); cb->setText( browseLink->url().toDisplayString(), QClipboard::Clipboard ); @@ -4608,7 +4608,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo } ); } - connect( processLink, &QAction::triggered, [this, link]() { + connect( processLink, &QAction::triggered, this, [this, link]() { d->document->processAction( link ); }); return menu; @@ -4621,7 +4621,7 @@ void PageView::addSearchWithinDocumentAction(QMenu *menu, const QString &searchT const QString squeezedText = KStringHandler::rsqueeze( searchText, searchTextPreviewLength ); QAction *action = new QAction(i18n("Search for '%1' in this document", squeezedText), menu); action->setIcon( QIcon::fromTheme( QStringLiteral("document-preview") ) ); - connect(action, &QAction::triggered, [this, searchText]{Q_EMIT triggerSearch(searchText);}); + connect(action, &QAction::triggered, this, [this, searchText]{Q_EMIT triggerSearch(searchText);}); menu->addAction( action ); }