summaryrefslogtreecommitdiffhomepage
path: root/mullvad-api/src
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-10-01 11:20:21 +0200
committerSebastian Holmin <sebastian.holmin@mullvad.net>2024-10-16 09:56:51 +0200
commit3aa952b3a6ecaffa5dc5c70f2435c2d297d8d2ef (patch)
treeefd452bdb249018e4059f8e309f5756c1d58dcb6 /mullvad-api/src
parentae1c1cefb5c048fcec021397a85ad886197913f7 (diff)
downloadmullvadvpn-3aa952b3a6ecaffa5dc5c70f2435c2d297d8d2ef.tar.xz
mullvadvpn-3aa952b3a6ecaffa5dc5c70f2435c2d297d8d2ef.zip
Add `impl From<Infallible> for Error`
Diffstat (limited to 'mullvad-api/src')
-rw-r--r--mullvad-api/src/rest.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/mullvad-api/src/rest.rs b/mullvad-api/src/rest.rs
index 0a2bed93b7..058fabd8ab 100644
--- a/mullvad-api/src/rest.rs
+++ b/mullvad-api/src/rest.rs
@@ -22,6 +22,7 @@ use hyper::{
use mullvad_types::account::AccountNumber;
use std::{
borrow::Cow,
+ convert::Infallible,
error::Error as StdError,
str::FromStr,
sync::{Arc, Weak},
@@ -72,6 +73,12 @@ pub enum Error {
NoAccessTokenStore,
}
+impl From<Infallible> for Error {
+ fn from(_: Infallible) -> Self {
+ unreachable!()
+ }
+}
+
impl Error {
pub fn is_network_error(&self) -> bool {
matches!(self, Error::HyperError(_) | Error::TimeoutError)