Skip to content

Commit 10aff00

Browse files
Copilotf2calv
andcommitted
Fix Option display in log statements - use unwrap_or instead of Debug format
Co-authored-by: f2calv <16097639+f2calv@users.noreply.github.com>
1 parent 33f3317 commit 10aff00

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/main.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,20 @@ async fn main() -> std::io::Result<()> {
3333
);
3434

3535
log::info!(
36-
"Git information; repository '{:?}', branch '{:?}', commit '{:?}', tag '{:?}'",
37-
app_settings.git_repository,
38-
app_settings.git_branch,
39-
app_settings.git_commit,
40-
app_settings.git_tag,
36+
"Git information; repository '{}', branch '{}', commit '{}', tag '{}'",
37+
app_settings.git_repository.as_deref().unwrap_or("N/A"),
38+
app_settings.git_branch.as_deref().unwrap_or("N/A"),
39+
app_settings.git_commit.as_deref().unwrap_or("N/A"),
40+
app_settings.git_tag.as_deref().unwrap_or("N/A"),
4141
);
4242

43+
let run_id = app_settings.github_run_id.map(|v| v.to_string());
44+
let run_number = app_settings.github_run_number.map(|v| v.to_string());
4345
log::info!(
44-
"GitHub information; workflow '{:?}', run id '{:?}', run number '{:?}'",
45-
app_settings.github_workflow,
46-
app_settings.github_run_id,
47-
app_settings.github_run_number,
46+
"GitHub information; workflow '{}', run id '{}', run number '{}'",
47+
app_settings.github_workflow.as_deref().unwrap_or("N/A"),
48+
run_id.as_deref().unwrap_or("N/A"),
49+
run_number.as_deref().unwrap_or("N/A"),
4850
);
4951

5052
tokio::time::sleep(Duration::from_millis(3_000)).await;
@@ -79,8 +81,9 @@ impl std::fmt::Display for AppSettings {
7981
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8082
write!(
8183
f,
82-
"git_repository='{:?}', git_branch='{:?}'",
83-
self.git_repository, self.git_branch
84+
"git_repository='{}', git_branch='{}'",
85+
self.git_repository.as_deref().unwrap_or("N/A"),
86+
self.git_branch.as_deref().unwrap_or("N/A"),
8487
)
8588
}
8689
}

0 commit comments

Comments
 (0)