Skip to content

Commit cd03a58

Browse files
jplattepoljar
authored andcommitted
refactor(examples): Use if-let chains in oauth_cli
1 parent 4a1249f commit cd03a58

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

examples/oauth_cli/src/main.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,10 @@ impl OAuthCli {
140140
let cli = Self { client, restored: false, session_file };
141141

142142
if let Err(error) = cli.register_and_login().await {
143-
if error.downcast_ref::<OAuthError>().is_some_and(|error| {
144-
matches!(
145-
error,
146-
OAuthError::ClientRegistration(OAuthClientRegistrationError::NotSupported)
147-
)
148-
}) {
143+
if let Some(error) = error.downcast_ref::<OAuthError>()
144+
&& let OAuthError::ClientRegistration(OAuthClientRegistrationError::NotSupported) =
145+
error
146+
{
149147
// This would require to register with the authorization server manually, which
150148
// we don't support here.
151149
bail!(

0 commit comments

Comments
 (0)