How to show the first few errors of rustc
(Jin Qing’s Column, Sep. 1, 2021)
When using VS Code to develop Rust, “cargo check” output maybe thousands of lines.
Use “cargo check --color=always 2>&1 | head -n100” to limit the output.
- Change powershell terminal to cmd, because powershell fails to use pipe
- Terminal -> New Terminal to open a terminal
- Open the dropdown list by click the down arrow of “+” on the top-left of terminal
- Select “Command Prompt”
- Type and run command:
cargo test 2>&1 --color always | "d:\Program Files\Git\usr\bin\head.exe" -n100
- You should change the path of head.exe