Skip to content

Commit

Permalink
impr: Remove usage of unstable inspect_err
Browse files Browse the repository at this point in the history
Note: this commit can be reverted when MSRV can be bumped to 1.76.
  • Loading branch information
fabianfreyer committed Jan 12, 2024
1 parent 383196c commit e5e8b8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ impl Cli {

let mut args = vec![CString::new(binary).unwrap()];
let binary = which::which(binary)
.inspect_err(|e| log::error!("Cannot find the given binary: {e}"))
// Replace with inspect_err when result_option_inspect is stabilized
.map_err(|e| {
log::error!("Cannot find the given binary: {e}");
e
})
.map(|ref path| CString::new(path.to_str().unwrap()))
.unwrap_or(CString::new(""))
.unwrap();
Expand Down
8 changes: 6 additions & 2 deletions src/datasource/k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ impl Source for ConfigMap {
}

async fn watch(&mut self, notify: Notifier) {
let Ok(client) = Client::try_default().await.inspect_err(|e| {
// Replace with inspect_err when result_option_inspect is stabilized
let Ok(client) = Client::try_default().await.map_err(|e| {
log::error!("Could not get k8s client: {e}");
e
}) else {
return;
};
Expand Down Expand Up @@ -168,8 +170,10 @@ impl Source for Secret {
}

async fn watch(&mut self, notify: Notifier) {
let Ok(client) = Client::try_default().await.inspect_err(|e| {
// Replace with inspect_err when result_option_inspect is stabilized
let Ok(client) = Client::try_default().await.map_err(|e| {
log::error!("Could not get k8s client: {e}");
e
}) else {
return;
};
Expand Down

0 comments on commit e5e8b8a

Please sign in to comment.