Skip to content

style: qualify anyhow::Result<> everywhere - #5052

Merged
rami3l merged 2 commits into
rust-lang:mainfrom
rami3l:copilot/remove-anyhow-result-imports-again
Sep 4, 2026
Merged

style: qualify anyhow::Result<> everywhere#5052
rami3l merged 2 commits into
rust-lang:mainfrom
rami3l:copilot/remove-anyhow-result-imports-again

Conversation

@rami3l

@rami3l rami3l commented Sep 3, 2026

Copy link
Copy Markdown
Member

Note

This PR is generated with GitHub Copilot on GPT 5.6 Luna, with manual review and minor modifications.

As suggested in #5042 (comment), this patch qualifies all uses of anyhow::Result<> across the repo.

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.

🟢 Approval recommended

The changes are mechanical and consistent with the stated goal, with only a small localized cleanup suggestion noted in review comments.

Pull request overview

This PR performs a repo-wide style refactor to consistently spell result types as anyhow::Result<...> (rather than importing anyhow::Result as Result), aligning error-return signatures across modules and tests.

Changes:

  • Removes use anyhow::Result (and {..., Result, ...}) imports and updates function/trait signatures to anyhow::Result<...>.
  • Updates a handful of collect::<Result<_>>() / collect::<Result<Vec<_>>>() call sites to the fully-qualified collect::<anyhow::Result<_>>().
  • Includes a small formatting modernization in a test helper (format!("\\x{byte:02x}")).
File summaries
File Description
tests/suite/static_roots.rs Updates a formatting call while keeping the test helper’s anyhow::Result signature qualified.
src/utils/mod.rs Converts many utility function signatures to anyhow::Result<...> and drops the Result import.
src/test.rs Updates test-only helper signatures/closures to use anyhow::Result.
src/settings.rs Updates settings read/write/parse helpers to return anyhow::Result.
src/process.rs Updates environment/path helper APIs to use qualified anyhow::Result types.
src/lib.rs Updates a public helper API to return anyhow::Result.
src/install.rs Updates install/uninstall helpers to return anyhow::Result.
src/fallback_settings.rs Updates unix-only fallback settings constructor to return anyhow::Result.
src/dist/temp.rs Updates temp context APIs to return anyhow::Result and removes Result re-export.
src/dist/mod.rs Updates parsing/resolve helpers and internal APIs to return anyhow::Result.
src/dist/manifestation/tests.rs Updates test helpers to use anyhow::Result and drops Result import.
src/dist/manifestation.rs Updates installation/stream types and helpers to use qualified anyhow::Result.
src/dist/manifest.rs Updates manifest parsing/validation APIs and serde helpers to use anyhow::Result.
src/dist/download.rs Updates download/hashing APIs to use qualified anyhow::Result.
src/dist/config.rs Updates dist config parse/stringify APIs to use anyhow::Result.
src/dist/component/transaction.rs Updates transaction APIs to return anyhow::Result and drops Result import.
src/dist/component/package.rs Updates package/unpack helpers to use qualified anyhow::Result.
src/dist/component/components.rs Updates component management APIs/builders to return anyhow::Result.
src/diskio/test.rs Updates test helpers to return anyhow::Result.
src/diskio/mod.rs Updates disk I/O creation helpers to return anyhow::Result.
src/config.rs Updates configuration APIs and internal helper results to qualified anyhow::Result.
src/command.rs Updates command runner signature to return anyhow::Result.
src/cli/topical_doc.rs Updates docs path search helpers to return anyhow::Result.
src/cli/setup_mode.rs Updates setup-mode entrypoint signature to return anyhow::Result.
src/cli/self_update/windows.rs Updates Windows self-update helpers to return anyhow::Result.
src/cli/self_update/unix.rs Updates Unix self-update helpers to return anyhow::Result.
src/cli/self_update/shell.rs Updates shell script helpers/trait methods to return anyhow::Result.
src/cli/self_update.rs Updates self-update flow APIs to return qualified anyhow::Result.
src/cli/rustup_mode.rs Updates CLI command handlers and a few collect sites to use anyhow::Result.
src/cli/proxy_mode.rs Updates proxy-mode entrypoint signature to return anyhow::Result.
src/cli/docs.rs Updates docs subcommand and server helpers to return anyhow::Result.
src/cli/common.rs Updates common CLI helpers and collect site to use qualified anyhow::Result.
src/bin/rustup-init.rs Updates rustup-init entrypoint and async runners to return anyhow::Result.
Review details
  • Files reviewed: 23/33 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

View changes since this review

Comment thread src/utils/mod.rs Outdated
rami3l and others added 2 commits September 4, 2026 10:32
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@rami3l
rami3l force-pushed the copilot/remove-anyhow-result-imports-again branch from 8a5547a to 072b7c9 Compare September 4, 2026 08:32
@rami3l
rami3l marked this pull request as ready for review September 4, 2026 10:03
@rami3l
rami3l requested a review from djc September 4, 2026 10:03

@djc djc 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.

Nice, thanks! Now we just have to present new uses from sneaking in...

View changes since this review

@rami3l
rami3l added this pull request to the merge queue Sep 4, 2026
Merged via the queue into rust-lang:main with commit 7e453e9 Sep 4, 2026
31 checks passed
@rami3l
rami3l deleted the copilot/remove-anyhow-result-imports-again branch September 4, 2026 10:54
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.

3 participants