diff options
author | Eike Ziller <[email protected]> | 2024-05-06 16:49:18 +0200 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2024-05-07 10:41:32 +0000 |
commit | 770f1b0376db49b9ea5aad906dd6165ab71d9152 (patch) | |
tree | 82550a2b183ac1dca16ee9716062302a08a9a66a /src/plugins/languageclient/clientrequest.cpp | |
parent | 67072d3f5bb1b425a2b9d3bf30d57542e9f88902 (diff) |
LanguageClient: Avoid calling throwing functions
Similar to with std::optional we want to avoid calling throwing
functions for std::variant, which includes std::get.
In many cases this also avoids the chain of `std::holds_alternative` +
`std::get` calls. And we never declare any `throws`.
Change-Id: I14f62ddef921b6bee90226ea34d1ffa62629bdc3
Reviewed-by: David Schulz <[email protected]>
Reviewed-by: <[email protected]>
Diffstat (limited to 'src/plugins/languageclient/clientrequest.cpp')
-rw-r--r-- | src/plugins/languageclient/clientrequest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/languageclient/clientrequest.cpp b/src/plugins/languageclient/clientrequest.cpp index 4e221f1b9d4..3125b25a72c 100644 --- a/src/plugins/languageclient/clientrequest.cpp +++ b/src/plugins/languageclient/clientrequest.cpp @@ -29,7 +29,8 @@ bool ClientWorkspaceSymbolRequest::preStartCheck() = client()->capabilities().workspaceSymbolProvider(); if (!capability.has_value()) return false; - if (std::holds_alternative<bool>(*capability) && !std::get<bool>(*capability)) + const auto boolvalue = std::get_if<bool>(&*capability); + if (boolvalue && !boolvalue) return false; return true; |