Skip to content

Commit

Permalink
Prefer inspect_err over map_err
Browse files Browse the repository at this point in the history
This fixes a new clippy lint.
  • Loading branch information
robin-nitrokey committed Oct 18, 2024
1 parent 699539a commit 4b3953a
Showing 1 changed file with 22 additions and 31 deletions.
53 changes: 22 additions & 31 deletions src/ctap2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,8 @@ pub trait Authenticator {
Request::MakeCredential(request) => {
debug_now!("CTAP2.MC");
Ok(Response::MakeCredential(
self.make_credential(request).map_err(|e| {
debug!("error: {:?}", e);
e
self.make_credential(request).inspect_err(|_e| {
debug!("error: {:?}", _e);
})?,
))
}
Expand All @@ -470,9 +469,8 @@ pub trait Authenticator {
Request::GetAssertion(request) => {
debug_now!("CTAP2.GA");
Ok(Response::GetAssertion(
self.get_assertion(request).map_err(|e| {
debug!("error: {:?}", e);
e
self.get_assertion(request).inspect_err(|_e| {
debug!("error: {:?}", _e);
})?,
))
}
Expand All @@ -481,30 +479,27 @@ pub trait Authenticator {
Request::GetNextAssertion => {
debug_now!("CTAP2.GNA");
Ok(Response::GetNextAssertion(
self.get_next_assertion().map_err(|e| {
debug!("error: {:?}", e);
e
self.get_next_assertion().inspect_err(|_e| {
debug!("error: {:?}", _e);
})?,
))
}

// 0x7
Request::Reset => {
debug_now!("CTAP2.RST");
self.reset().map_err(|e| {
debug!("error: {:?}", e);
e
self.reset().inspect_err(|_e| {
debug!("error: {:?}", _e);
})?;
Ok(Response::Reset)
}

// 0x6
Request::ClientPin(request) => {
debug_now!("CTAP2.PIN");
Ok(Response::ClientPin(self.client_pin(request).map_err(
|e| {
debug!("error: {:?}", e);
e
Ok(Response::ClientPin(self.client_pin(request).inspect_err(
|_e| {
debug!("error: {:?}", _e);
},
)?))
}
Expand All @@ -513,40 +508,36 @@ pub trait Authenticator {
Request::CredentialManagement(request) => {
debug_now!("CTAP2.CM");
Ok(Response::CredentialManagement(
self.credential_management(request).map_err(|e| {
debug!("error: {:?}", e);
e
self.credential_management(request).inspect_err(|_e| {
debug!("error: {:?}", _e);
})?,
))
}

// 0xB
Request::Selection => {
debug_now!("CTAP2.SEL");
self.selection().map_err(|e| {
debug!("error: {:?}", e);
e
self.selection().inspect_err(|_e| {
debug!("error: {:?}", _e);
})?;
Ok(Response::Selection)
}

// 0xC
Request::LargeBlobs(request) => {
debug_now!("CTAP2.LB");
Ok(Response::LargeBlobs(self.large_blobs(request).map_err(
|e| {
debug!("error: {:?}", e);
e
},
)?))
Ok(Response::LargeBlobs(
self.large_blobs(request).inspect_err(|_e| {
debug!("error: {:?}", _e);
})?,
))
}

// Not stable
Request::Vendor(op) => {
debug_now!("CTAP2.V");
self.vendor(*op).map_err(|e| {
debug!("error: {:?}", e);
e
self.vendor(*op).inspect_err(|_e| {
debug!("error: {:?}", _e);
})?;
Ok(Response::Vendor)
}
Expand Down

0 comments on commit 4b3953a

Please sign in to comment.