From 2f8c29082a527c66a9f50cca56725b6215808baa Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Wed, 12 Aug 2020 17:19:49 +0200 Subject: [PATCH] Enable the modernize-use-equals-default check on clang-tidy Signed-off-by: Kevin Ottens --- .clang-tidy | 1 + src/common/ownsql.cpp | 4 +--- src/common/syncjournalfilerecord.cpp | 4 +--- src/gui/accountmanager.h | 4 ++-- src/gui/creds/webflowcredentials.cpp | 5 +---- src/gui/folderwatcher_linux.h | 2 +- src/gui/systray.h | 2 +- src/gui/tray/UserModel.h | 4 ++-- src/gui/wizard/webviewpage.cpp | 7 ++++--- src/libsync/account.h | 2 +- src/libsync/creds/abstractcredentials.cpp | 4 +--- src/libsync/creds/httpcredentials.cpp | 4 +--- src/libsync/owncloudpropagator.h | 10 ++++------ src/libsync/syncfilestatus.cpp | 4 +--- src/libsync/syncresult.cpp | 4 +--- test/syncenginetestutils.h | 2 +- 16 files changed, 24 insertions(+), 39 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 17e948c2a..203c6393c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -16,6 +16,7 @@ Checks: '-*, modernize-use-emplace, modernize-use-equals-delete, modernize-use-nodiscard, + modernize-use-equals-default, modernize-use-noexcept, modernize-user-override, modernize-use-nullptr, diff --git a/src/common/ownsql.cpp b/src/common/ownsql.cpp index 5646e0ab4..04ec4106d 100644 --- a/src/common/ownsql.cpp +++ b/src/common/ownsql.cpp @@ -43,9 +43,7 @@ namespace OCC { Q_LOGGING_CATEGORY(lcSql, "nextcloud.sync.database.sql", QtInfoMsg) -SqlDatabase::SqlDatabase() -{ -} +SqlDatabase::SqlDatabase() = default; SqlDatabase::~SqlDatabase() { diff --git a/src/common/syncjournalfilerecord.cpp b/src/common/syncjournalfilerecord.cpp index 082b52b6d..24244eb12 100644 --- a/src/common/syncjournalfilerecord.cpp +++ b/src/common/syncjournalfilerecord.cpp @@ -21,9 +21,7 @@ namespace OCC { -SyncJournalFileRecord::SyncJournalFileRecord() -{ -} +SyncJournalFileRecord::SyncJournalFileRecord() = default; QByteArray SyncJournalFileRecord::numericFileId() const { diff --git a/src/gui/accountmanager.h b/src/gui/accountmanager.h index 4719b8109..e06148757 100644 --- a/src/gui/accountmanager.h +++ b/src/gui/accountmanager.h @@ -28,7 +28,7 @@ class AccountManager : public QObject Q_OBJECT public: static AccountManager *instance(); - ~AccountManager() {} + ~AccountManager() = default; /** * Saves the accounts to a given settings file @@ -89,7 +89,7 @@ private: // Adds an account to the tracked list, emitting accountAdded() void addAccountState(AccountState *accountState); - AccountManager() {} + AccountManager() = default; QList _accounts; public slots: diff --git a/src/gui/creds/webflowcredentials.cpp b/src/gui/creds/webflowcredentials.cpp index 58beb358c..d1c73597b 100644 --- a/src/gui/creds/webflowcredentials.cpp +++ b/src/gui/creds/webflowcredentials.cpp @@ -85,10 +85,7 @@ static void addSettingsToJob(Account *account, QKeychain::Job *job) } #endif -WebFlowCredentials::WebFlowCredentials() -{ - -} +WebFlowCredentials::WebFlowCredentials() = default; WebFlowCredentials::WebFlowCredentials(const QString &user, const QString &password, const QSslCertificate &certificate, const QSslKey &key, const QList &caCertificates) : _user(user) diff --git a/src/gui/folderwatcher_linux.h b/src/gui/folderwatcher_linux.h index 24d337777..e44fc421c 100644 --- a/src/gui/folderwatcher_linux.h +++ b/src/gui/folderwatcher_linux.h @@ -33,7 +33,7 @@ class FolderWatcherPrivate : public QObject { Q_OBJECT public: - FolderWatcherPrivate() {} + FolderWatcherPrivate() = default; FolderWatcherPrivate(FolderWatcher *p, const QString &path); ~FolderWatcherPrivate(); diff --git a/src/gui/systray.h b/src/gui/systray.h index 995d7c619..d4282cb86 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -45,7 +45,7 @@ class Systray Q_OBJECT public: static Systray *instance(); - virtual ~Systray() {}; + virtual ~Systray() = default; enum class TaskBarPosition { Bottom, Left, Top, Right }; Q_ENUM(TaskBarPosition); diff --git a/src/gui/tray/UserModel.h b/src/gui/tray/UserModel.h index 8fcd65f80..fd48f1110 100644 --- a/src/gui/tray/UserModel.h +++ b/src/gui/tray/UserModel.h @@ -91,7 +91,7 @@ class UserModel : public QAbstractListModel Q_PROPERTY(User* currentUser READ currentUser NOTIFY newUserSelected) public: static UserModel *instance(); - virtual ~UserModel() {}; + virtual ~UserModel() = default; void addUser(AccountStatePtr &user, const bool &isCurrent = false); int currentUserIndex(); @@ -163,7 +163,7 @@ class UserAppsModel : public QAbstractListModel Q_OBJECT public: static UserAppsModel *instance(); - virtual ~UserAppsModel() {}; + virtual ~UserAppsModel() = default; int rowCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/gui/wizard/webviewpage.cpp b/src/gui/wizard/webviewpage.cpp index fc86ba419..01311e839 100644 --- a/src/gui/wizard/webviewpage.cpp +++ b/src/gui/wizard/webviewpage.cpp @@ -32,9 +32,10 @@ WebViewPage::WebViewPage(QWidget *parent) //_useSystemProxy = QNetworkProxyFactory::usesSystemConfiguration(); } -WebViewPage::~WebViewPage() { - //QNetworkProxyFactory::setUseSystemConfiguration(_useSystemProxy); -} +WebViewPage::~WebViewPage() = default; +//{ +// QNetworkProxyFactory::setUseSystemConfiguration(_useSystemProxy); +//} void WebViewPage::initializePage() { //QNetworkProxy::setApplicationProxy(QNetworkProxy::applicationProxy()); diff --git a/src/libsync/account.h b/src/libsync/account.h index 3df7a29a1..92008ff08 100644 --- a/src/libsync/account.h +++ b/src/libsync/account.h @@ -62,7 +62,7 @@ class SimpleNetworkJob; class AbstractSslErrorHandler { public: - virtual ~AbstractSslErrorHandler() {} + virtual ~AbstractSslErrorHandler() = default; virtual bool handleErrors(QList, const QSslConfiguration &conf, QList *, AccountPtr) = 0; }; diff --git a/src/libsync/creds/abstractcredentials.cpp b/src/libsync/creds/abstractcredentials.cpp index e71ca059e..839bf3bbb 100644 --- a/src/libsync/creds/abstractcredentials.cpp +++ b/src/libsync/creds/abstractcredentials.cpp @@ -23,9 +23,7 @@ namespace OCC { Q_LOGGING_CATEGORY(lcCredentials, "nextcloud.sync.credentials", QtInfoMsg) -AbstractCredentials::AbstractCredentials() -{ -} +AbstractCredentials::AbstractCredentials() = default; void AbstractCredentials::setAccount(Account *account) { diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index a5e74da51..9b1d10a9e 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -103,9 +103,7 @@ static void addSettingsToJob(Account *account, QKeychain::Job *job) job->setSettings(settings.release()); } -HttpCredentials::HttpCredentials() -{ -} +HttpCredentials::HttpCredentials() = default; // From wizard HttpCredentials::HttpCredentials(const QString &user, const QString &password, const QSslCertificate &certificate, const QSslKey &key) diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index af944e8e9..e00ed328c 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -225,12 +225,10 @@ public: { } - virtual ~PropagatorCompositeJob() - { - // Don't delete jobs in _jobsToDo and _runningJobs: they have parents - // that will be responsible for cleanup. Deleting them here would risk - // deleting something that has already been deleted by a shared parent. - } + // Don't delete jobs in _jobsToDo and _runningJobs: they have parents + // that will be responsible for cleanup. Deleting them here would risk + // deleting something that has already been deleted by a shared parent. + virtual ~PropagatorCompositeJob() = default; void appendJob(PropagatorJob *job); void appendTask(const SyncFileItemPtr &item) diff --git a/src/libsync/syncfilestatus.cpp b/src/libsync/syncfilestatus.cpp index c937f9b29..6ffea64c2 100644 --- a/src/libsync/syncfilestatus.cpp +++ b/src/libsync/syncfilestatus.cpp @@ -15,9 +15,7 @@ #include "syncfilestatus.h" namespace OCC { -SyncFileStatus::SyncFileStatus() -{ -} +SyncFileStatus::SyncFileStatus() = default; SyncFileStatus::SyncFileStatus(SyncFileStatusTag tag) : _tag(tag) diff --git a/src/libsync/syncresult.cpp b/src/libsync/syncresult.cpp index e33d7354e..2e2c01033 100644 --- a/src/libsync/syncresult.cpp +++ b/src/libsync/syncresult.cpp @@ -17,9 +17,7 @@ namespace OCC { -SyncResult::SyncResult() -{ -} +SyncResult::SyncResult() = default; SyncResult::Status SyncResult::status() const { diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index fedf091ac..055f11e45 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -66,7 +66,7 @@ public: class FileModifier { public: - virtual ~FileModifier() { } + virtual ~FileModifier() = default; virtual void remove(const QString &relativePath) = 0; virtual void insert(const QString &relativePath, qint64 size = 64, char contentChar = 'W') = 0; virtual void setContents(const QString &relativePath, char contentChar) = 0;