Skip to content

Commit

Permalink
Replace remaining unwraps with better explained .expect()s
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyKasmy committed May 17, 2023
1 parent 1773b9a commit 2ad869a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion fetcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ fn set_up_logging() -> Result<()> {
.with(journald.with_filter(LevelFilter::INFO))
.with(stdout.with_filter(env_filter));

tracing::subscriber::set_global_default(subscriber).unwrap();
tracing::subscriber::set_global_default(subscriber)
.expect("tracing shouldn't already have been set up");

color_eyre::install()?;
Ok(())
Expand Down
6 changes: 4 additions & 2 deletions fetcher/src/settings/data/runtime_external_save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ impl ExternalSave for TruncatingFileWriter {
if let Some(rf_conf) =
fetcher_config::jobs::read_filter::ReadFilter::unparse(read_filter).await
{
let s = serde_json::to_string(&rf_conf).unwrap();
let s = serde_json::to_string(&rf_conf)
.expect("A ReadFilter should always be serializable");

self.write(s.as_bytes())
.await
Expand All @@ -70,7 +71,8 @@ impl ExternalSave for TruncatingFileWriter {
) -> Result<(), ExternalSaveError> {
let map_conf =
fetcher_config::jobs::task::entry_to_msg_map::EntryToMsgMap::unparse(map.clone());
let s = serde_json::to_string(&map_conf).unwrap();
let s = serde_json::to_string(&map_conf)
.expect("An EntryToMsgMap should always be serializable");

self.write(s.as_bytes())
.await
Expand Down

0 comments on commit 2ad869a

Please sign in to comment.