How about displaying the offending lines with something like:
EDIT: Diff was generated on a dirty commit by mistake.
diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs
index f9df576239..687d11c4e0 100644
--- a/test/lint/test_runner/src/main.rs
+++ b/test/lint/test_runner/src/main.rs
@@ -129 +129 @@ fn lint_trailing_whitespace() -> LintResult {
- let trailing_space = git()
+ let trailing_whitespace = check_output(git()
@@ -131,6 +131,4 @@ fn lint_trailing_whitespace() -> LintResult {
- .args(get_pathspecs_exclude_whitespace())
- .status()
- .expect("command error")
- .success();
- if trailing_space {
- Err(r#"
+ .args(get_pathspecs_exclude_whitespace()));
+ if let Ok(message) = trailing_whitespace {
+ Err(format!(r#"
+{}
@@ -146,2 +144,2 @@ sourced files to the exclude list.
- "#
- .to_string())
+ "#,
+ message))
@@ -154 +152 @@ fn lint_tabs_whitespace() -> LintResult {
- let tabs = git()
+ let tabs = check_output(git()
@@ -157,6 +155,4 @@ fn lint_tabs_whitespace() -> LintResult {
- .args(get_pathspecs_exclude_whitespace())
- .status()
- .expect("command error")
- .success();
- if tabs {
- Err(r#"
+ .args(get_pathspecs_exclude_whitespace()));
+ if let Ok(message) = tabs {
+ Err(format!(r#"
+{}
@@ -170,2 +166,2 @@ Please add any false positives, such as subtrees, or externally sourced files to
- "#
- .to_string())
+ "#,
+ message))