Skip to content

fix(cargo): preserve --message-format=short warnings and errors - #5404

Open
MasihMoafi wants to merge 1 commit into
rtk-ai:developfrom
MasihMoafi:fix/cargo-short-format-warnings
Open

MasihMoafi wants to merge 1 commit into
rtk-ai:developfrom
MasihMoafi:fix/cargo-short-format-warnings

Conversation

@MasihMoafi

Copy link
Copy Markdown

Closes #5064.

Problem

cargo build --message-format=short and cargo check --message-format=short emit single-line diagnostics in the form path:line:col: warning: ... or path:line:col: error[E...]: .... CargoBuildHandler::is_block_start only matched lines starting with warning: or error:, so short-format warnings were dropped and the build reported clean.

Fix

  • Recognize single-line <path>:<line>:<col>: warning/error diagnostics in CargoBuildHandler::is_block_start (including Windows drive paths).
  • End short-format blocks after one line in is_block_continuation so consecutive diagnostics or trailing lines do not merge into one block.
  • Add unit tests covering streamed cargo build and cargo check short-format warnings, errors, and Windows paths.

Verification

  • cargo fmt --check
  • cargo test --lib cargo_cmd (92 passed, 0 failed)

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.

rtk cargo build --message-format=short reports a clean build and drops the warnings

1 participant