Skip to content

Commit

Permalink
chore: fix clippy warnings
Browse files Browse the repository at this point in the history
Address clippy warnings

Signed-off-by: Flavio Castelli <[email protected]>
  • Loading branch information
flavio committed Mar 16, 2023
1 parent 14f1b84 commit fb76ef4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/callback_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl CallbackHandler {
) -> Result<CallbackHandler> {
match &cfg.host_capabilities_mode {
HostCapabilitiesMode::Proxy(proxy_mode) => {
new_proxy(&proxy_mode, cfg, kube_client, shutdown_channel).await
new_proxy(proxy_mode, cfg, kube_client, shutdown_channel).await
}
HostCapabilitiesMode::Direct => {
new_transparent(cfg, kube_client, shutdown_channel).await
Expand Down
8 changes: 4 additions & 4 deletions src/callback_handler/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ impl CallbackHandlerProxy {
// there's no nice way to handle errors here.

let mut exchanges: VecDeque<Exchange> = if let ProxyMode::Replay { source } = &self.mode {
let file = File::open(source).expect(
format!("Cannot open host capabilities interactions file {source:?}",).as_str(),
);
let file = File::open(source).unwrap_or_else(|_| {
panic!("Cannot open host capabilities interactions file {source:?}")
});
serde_yaml::from_reader(file)
.expect(format!("cannot deserialize contents of {source:?}").as_str())
.unwrap_or_else(|_| panic!("cannot deserialize contents of {source:?}"))
} else {
// this should never happen
unreachable!()
Expand Down
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,7 @@ async fn parse_pull_and_run_settings(matches: &ArgMatches) -> Result<run::PullAn
let destination = matches
.get_one::<String>("record-host-capabilities-interactions")
.map(|destination| PathBuf::from_str(destination).unwrap())
.ok_or_else(|| anyhow!("Cannot parse 'record-host-capabilities-interactions' file"))?
.to_owned();
.ok_or_else(|| anyhow!("Cannot parse 'record-host-capabilities-interactions' file"))?;

// TODO: replace eprintln with info
// once https://github.com/swsnr/mdcat/issues/242 is fixed
Expand All @@ -653,8 +652,7 @@ async fn parse_pull_and_run_settings(matches: &ArgMatches) -> Result<run::PullAn
let source = matches
.get_one::<String>("replay-host-capabilities-interactions")
.map(|source| PathBuf::from_str(source).unwrap())
.ok_or_else(|| anyhow!("Cannot parse 'replay-host-capabilities-interaction' file"))?
.to_owned();
.ok_or_else(|| anyhow!("Cannot parse 'replay-host-capabilities-interaction' file"))?;

// TODO: replace eprintln with info
// once https://github.com/swsnr/mdcat/issues/242 is fixed
Expand Down
2 changes: 1 addition & 1 deletion src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub(crate) async fn prepare_run_env(cfg: &PullAndRunSettings) -> Result<RunEnv>
oneshot::channel();

let callback_handler =
CallbackHandler::new(&cfg, kube_client, callback_handler_shutdown_channel_rx).await?;
CallbackHandler::new(cfg, kube_client, callback_handler_shutdown_channel_rx).await?;

let callback_sender_channel = callback_handler.sender_channel();

Expand Down

0 comments on commit fb76ef4

Please sign in to comment.