Remove default cases in switches, rely on compiler warnings for missed cases
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Sat, 1 Oct 2022 09:35:26 +0000 (11:35 +0200)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 31 Oct 2022 17:06:08 +0000 (18:06 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/shareemodel.cpp
src/gui/filedetails/sharemodel.cpp

index c4be699a7abce03cc81263bc5e38203ca8bc9e96..6f4fd97a6ac8aef1e8cdc77666e7fe2cdfad3768 100644 (file)
@@ -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 --------------------------- //
index cb511f038def151386b89d8a40f45bf25baaf1b9..7eb3c0c0abe41044e0f4f2246e427b144fa9b6f8 100644 (file)
@@ -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<UserGroupShare>()) {
@@ -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 ---------------------- //