From 121ab3817710bc9c94d1e92feea2d8c8dbdb8fee Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Sat, 1 Oct 2022 11:35:26 +0200 Subject: [PATCH] Remove default cases in switches, rely on compiler warnings for missed cases Signed-off-by: Claudio Cambra --- src/gui/filedetails/shareemodel.cpp | 6 +++--- src/gui/filedetails/sharemodel.cpp | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gui/filedetails/shareemodel.cpp b/src/gui/filedetails/shareemodel.cpp index c4be699a7..6f4fd97a6 100644 --- a/src/gui/filedetails/shareemodel.cpp +++ b/src/gui/filedetails/shareemodel.cpp @@ -72,10 +72,10 @@ QVariant ShareeModel::data(const QModelIndex &index, const int role) const return QString(sharee->displayName() + " (" + sharee->shareWith() + ")"); case ShareeRole: return QVariant::fromValue(sharee); - default: - qCWarning(lcShareeModel) << "Got unknown role -- returning null value."; - return {}; } + + qCWarning(lcShareeModel) << "Got unknown role" << role << "returning null value."; + return {}; } // --------------------------- QPROPERTY methods --------------------------- // diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index cb511f038..7eb3c0c0a 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -115,8 +115,6 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const const auto startOfExpireDayUTC = linkShare->getExpireDate().startOfDay(QTimeZone::utc()); return startOfExpireDayUTC.toMSecsSinceEpoch(); } - default: - break; } } else if (const auto userGroupShare = share.objectCast()) { @@ -132,8 +130,6 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const const auto startOfExpireDayUTC = userGroupShare->getExpireDate().startOfDay(QTimeZone::utc()); return startOfExpireDayUTC.toMSecsSinceEpoch(); } - default: - break; } } @@ -178,12 +174,12 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const case NoteRole: case ExpireDateRole: return {}; - default: - qCWarning(lcShareModel) << "Got unknown role" << role - << "for share of type" << share->getShareType() - << "so returning null value."; - return {}; } + + qCWarning(lcShareModel) << "Got unknown role" << role + << "for share of type" << share->getShareType() + << "so returning null value."; + return {}; } // ---------------------- Internal model data methods ---------------------- // -- 2.30.2