Skip to content

add --message-format short option #42653

Closed
@vitiral

Description

@vitiral

I copied this from rust-lang/cargo#4165 at @alexcrichton's request

--message-format currently has the following options:

--message-format FMT         Error format: human, json [default: human]

I would like an additional option to be added: short. Other possible names:

  • brief
  • oneline

I've been programming in rust for the better part of a year now. The compiler has been my friend and mentor through this time, and a big part of that has been the fantastic human readable error messages. Thank you so much for them!

However, I have gotten much more familiar with the language and my common mistakes. Therefore I rarely need the error messages to be so long (sometimes they are longer than 10-15 lines!). Normally I just need the compiler to give the me the file, line/col number and name of the error and I can spot it myself very quickly.

For an experienced programmer, the option of a shorter format would make finding errors much more ergonomic.

The following pipe does roughly what I want, although it would be nice if it was all on one line and the path:line:col was at the beginning

# cargo test |& rg "(error\[\w+\])|(^\s+--> \w+/\w+)" -N --color never
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
   --> src/user/tests.rs:186:37
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
   --> src/export.rs:133:51
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
   --> src/export.rs:139:37
error[E0063]: missing field `revision` in initializer of `export::ArtifactData`
   --> src/export.rs:149:20

Thanks!

Metadata

Metadata

Labels

C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions