Repository navigation
rust: stop discarding errors in adopt and the dx crate root (part of #13147) - #13329
Merged
Merged
Conversation
…art of #13147) Add dx_output::write_stderr, which logs a failed stderr write instead of dropping it. Route adopt and main.rs stderr writes through it, propagate stdout and file errors, and keep .ok() only with a reason. Deny unused_result_ok and map_err_ignore in cli/cli/src/adopt.rs and main.rs. dx upgrade now refuses when MODULE.bazel.lock cannot be read and reports a failed restore; dx init fails when .dx/pins cannot be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K
TrapsterDK
force-pushed
the
rust-adopt-unused-result-ok
branch
from
November 18, 2026 03:29
567954e to
8463980
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #13147.
dx_output::write_stderrwrites diagnostics and logs (tracing::info!) a failed stderr write instead of dropping it silently.cli/cli/src/adopt/*andcli/cli/src/main.rs: every stderr.ok()/drop(writeln!)goes through it; the watch clear-screen write is a checked stdout write;.ok()stays only where absence is the answer, each with a one-line reason.dx upgrade --applyrefuses (Infra, exit 3) whenMODULE.bazel.lockexists but cannot be read, before writing the edit; a failed restore after a failed refresh saysrestoring <path> failed: <e>instead of claimingrestored. Failedgitprobes are logged.dx initfails withinit_failedwhen.dx/pinsexists but cannot be read.#![deny(clippy::unused_result_ok, clippy::map_err_ignore)]oncli/cli/src/adopt.rsand themain.rscrate root.Tests:
write_stderrbytes and failing writer; lockfile-as-directory refusal; restore failure message;.dx/pins-as-directory.Ran:
tools/dx check --apply --affected(0),tools/dx test --affected(0),tools/dx check --affected(0),bazel test //cli/output:dx_output_test //cli/cli:dx_cli_test(pass; the fulldx_cli_testran ~63s on a loaded machine, past its 60s small timeout; it passed with--test_timeout=200). Nested-Bazel and consumer tests not run locally.Remaining for #13147:
cli/cli/src/exec/*(~300 sites), then move the deny fromadopt.rstocli/cli/src/lib.rs.drop(writeln!(..))sites elsewhere (rust: drop(writeln!(..)) discards errors that unused_result_ok cannot see #13317).🤖 Generated with Claude Code
https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K