mirror of
https://github.com/chatmail/core.git
synced 2026-05-14 04:16:30 +03:00
oauth2: replace unwrap() and is_none() with "if let"
This commit is contained in:
committed by
holger krekel
parent
9a43d26c60
commit
fde8fb960b
@@ -312,13 +312,12 @@ impl Oauth2 {
|
|||||||
}
|
}
|
||||||
if let Ok(response) = parsed {
|
if let Ok(response) = parsed {
|
||||||
// serde_json::Value.as_str() removes the quotes of json-strings
|
// serde_json::Value.as_str() removes the quotes of json-strings
|
||||||
let addr = response.get("email");
|
if let Some(addr) = response.get("email") {
|
||||||
if addr.is_none() {
|
Some(addr.to_string())
|
||||||
|
} else {
|
||||||
warn!(context, "E-mail missing in userinfo.");
|
warn!(context, "E-mail missing in userinfo.");
|
||||||
return None;
|
None
|
||||||
}
|
}
|
||||||
let addr = addr.unwrap().as_str();
|
|
||||||
addr.map(|addr| addr.to_string())
|
|
||||||
} else {
|
} else {
|
||||||
warn!(context, "Failed to parse userinfo.");
|
warn!(context, "Failed to parse userinfo.");
|
||||||
None
|
None
|
||||||
|
|||||||
Reference in New Issue
Block a user