diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-06-28 13:28:05 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-06-28 18:36:30 +0300 |
commit | f5f06752e35ca3d6d2f316399aa119b1e57a51d1 (patch) | |
tree | 8412828d79f506a98aa135f229e3f18f8bac6153 /src/common | |
parent | 3fd7001735d5791d7b1b9b74254b541cd5414386 (diff) |
Prevent implementations of Result<bool,..>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/result.h | 1 | ||||
-rw-r--r-- | src/common/vfs.cpp | 4 | ||||
-rw-r--r-- | src/common/vfs.h | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/common/result.h b/src/common/result.h index 500459664..c93b089d5 100644 --- a/src/common/result.h +++ b/src/common/result.h @@ -35,6 +35,7 @@ public: : _result(std::move(value)) , _isError(false) { + static_assert(!std::is_same<T, bool>::value, "Bool is not supported as this class overrides the bool operator"); } // TODO: This doesn't work if T and Error are too similar Result(Error error) diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp index 066a36c5c..efa0bee7b 100644 --- a/src/common/vfs.cpp +++ b/src/common/vfs.cpp @@ -63,7 +63,7 @@ Optional<Vfs::Mode> Vfs::modeFromString(const QString &str) return {}; } -Result<bool, QString> Vfs::checkAvailability(const QString &path) +Result<void, QString> Vfs::checkAvailability(const QString &path) { #ifdef Q_OS_WIN const auto mode = bestAvailableVfsMode(); @@ -84,7 +84,7 @@ Result<bool, QString> Vfs::checkAvailability(const QString &path) #else Q_UNUSED(path); #endif - return true; + return {}; } void Vfs::start(const VfsSetupParams ¶ms) diff --git a/src/common/vfs.h b/src/common/vfs.h index cc45eaa1a..678d2d39e 100644 --- a/src/common/vfs.h +++ b/src/common/vfs.h @@ -100,7 +100,7 @@ public: static QString modeToString(Mode mode); static Optional<Mode> modeFromString(const QString &str); - static Result<bool, QString> checkAvailability(const QString &path); + static Result<void, QString> checkAvailability(const QString &path); enum class AvailabilityError { |