Skip to content

Commit 4de4a95

Browse files
Add end whitespace ignore flag for tidy
1 parent 51d3cec commit 4de4a95

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/test/rustdoc/check-hard-break.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![crate_name = "foo"]
1212

13-
// ignore-tidy-linelength
13+
// ignore-tidy-end-whitespace
1414

1515
// @has foo/fn.f.html
1616
// @has - '<p>hard break:<br>after hard break</p>'

src/tools/tidy/src/style.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub fn check(path: &Path, bad: &mut bool) {
110110
let skip_cr = contents.contains("ignore-tidy-cr");
111111
let skip_tab = contents.contains("ignore-tidy-tab");
112112
let skip_length = contents.contains("ignore-tidy-linelength");
113+
let skip_end_whitespace = contents.contains("ignore-tidy-end-whitespace");
113114
for (i, line) in contents.split("\n").enumerate() {
114115
let mut err = |msg: &str| {
115116
println!("{}:{}: {}", file.display(), i + 1, msg);
@@ -122,7 +123,7 @@ pub fn check(path: &Path, bad: &mut bool) {
122123
if line.contains("\t") && !skip_tab {
123124
err("tab character");
124125
}
125-
if line.ends_with(" ") || line.ends_with("\t") {
126+
if !skip_end_whitespace && (line.ends_with(" ") || line.ends_with("\t")) {
126127
err("trailing whitespace");
127128
}
128129
if line.contains("\r") && !skip_cr {

0 commit comments

Comments
 (0)