Skip to content

Fix clippy unnecessary_unwrap warnings and rustfmt formatting - #481

Merged
cantino merged 3 commits into
masterfrom
copilot/fix-unnecessary-unwraps
Feb 25, 2026
Merged

Fix clippy unnecessary_unwrap warnings and rustfmt formatting#481
cantino merged 3 commits into
masterfrom
copilot/fix-unnecessary-unwraps

Conversation

Copilot AI commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Three instances of the is_some() + .unwrap() anti-pattern were triggering clippy::unnecessary_unwrap. A follow-up cargo fmt failure was also introduced by the refactor.

  • src/interface.rs: command.last_run.is_some() + .unwrap()if let Some(last_run) = command.last_run; collapse .signed_duration_since(...) per rustfmt
  • src/stats_generator.rs: settings.stats_only_dir.is_some() + .as_ref().unwrap()if let Some(stats_only_dir) = &settings.stats_only_dir
  • src/main.rs: settings.append_to_histfile.is_some() + .as_ref().unwrap()if let Some(append_to_histfile) = &settings.append_to_histfile
// Before
if settings.append_to_histfile.is_some() {
    let histfile = PathBuf::from(settings.append_to_histfile.as_ref().unwrap());

// After
if let Some(append_to_histfile) = &settings.append_to_histfile {
    let histfile = PathBuf::from(append_to_histfile);

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: cantino <83835+cantino@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix unnecessary unwrap warnings in code Fix clippy unnecessary_unwrap warnings Feb 23, 2026
Copilot AI requested a review from cantino February 23, 2026 05:29
Co-authored-by: cantino <83835+cantino@users.noreply.github.com>
Copilot AI changed the title Fix clippy unnecessary_unwrap warnings Fix clippy unnecessary_unwrap warnings and rustfmt formatting Feb 25, 2026
@cantino
cantino marked this pull request as ready for review February 25, 2026 00:22
@cantino
cantino merged commit b6c4d46 into master Feb 25, 2026
43 checks passed
@cantino
cantino deleted the copilot/fix-unnecessary-unwraps branch February 25, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants