Skip to content

fix(clippy): use Result::is_ok_and for Rust 1.98.0 manual_is_variant_and lint - #1631

Open
TheLarkInn wants to merge 1 commit into
mainfrom
selarkin/clippy-manual-is-variant-and
Open

fix(clippy): use Result::is_ok_and for Rust 1.98.0 manual_is_variant_and lint#1631
TheLarkInn wants to merge 1 commit into
mainfrom
selarkin/clippy-manual-is-variant-and

Conversation

@TheLarkInn

Copy link
Copy Markdown
Owner

What

Rust 1.98.0 stable shipped a new pedantic clippy lint, clippy::manual_is_variant_and, which fires on .ok().is_some_and(..) called on a Result. Because CI builds with -D warnings, the Build & Test job is now failing on main (first observed on #1630's run, which contains no Rust changes).

This replaces .ok().is_some_and(..) with the suggested .is_ok_and(..) (stable since Rust 1.70) at all six call sites:

  • crates/libaipm/src/resolver/mod.rs:468
  • crates/libaipm/src/security.rs:83
  • crates/libaipm/src/migrate/cleanup.rs:204, 280, 293 (tests)
  • crates/libaipm/src/version.rs:331 (test)

Result::ok().is_some_and(f) and Result::is_ok_and(f) are semantically identical — behavior is unchanged.

Unblocks #1630 and every other open PR.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

Rust 1.98.0 clippy promotes clippy::manual_is_variant_and, which fires on
`.ok().is_some_and(..)` called on a Result. This broke the Build & Test
clippy step (`-D warnings`) on main. Replace with `is_ok_and` (stable
since 1.70) at all six call sites, including test code.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates libaipm to satisfy Rust 1.98.0’s new clippy::manual_is_variant_and pedantic lint by replacing the Result::ok().is_some_and(..) pattern with the equivalent Result::is_ok_and(..), unblocking CI builds that run with -D warnings.

Changes:

  • Replace Result::ok().is_some_and(..) with Result::is_ok_and(..) in resolver candidate filtering logic.
  • Update enforcement env-var check to use is_ok_and(..) directly on the Result.
  • Update affected test assertions to use is_ok_and(..).
Show a summary per file
File Description
crates/libaipm/src/version.rs Updates a test assertion to use Result::is_ok_and(..) instead of ok().is_some_and(..).
crates/libaipm/src/security.rs Updates env-var enforcement check to use Result::is_ok_and(..) to satisfy the new clippy lint.
crates/libaipm/src/resolver/mod.rs Updates version-parse filtering to use Result::is_ok_and(..) without changing selection behavior.
crates/libaipm/src/migrate/cleanup.rs Updates several test assertions to use Result::is_ok_and(..) instead of ok().is_some_and(..).

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.57%. Comparing base (6d3368d) to head (893e46f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1631   +/-   ##
=======================================
  Coverage   97.57%   97.57%           
=======================================
  Files         127      127           
  Lines       39102    39102           
  Branches      974      974           
=======================================
  Hits        38154    38154           
  Misses        853      853           
  Partials       95       95           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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