Skip to content

Commit 4750c1e

Browse files
committed
Auto merge of #45080 - clippered:issue-44986/fix-windows-ui-path, r=estebank
Issue 44986/fix windows ui path #44968
2 parents 439f752 + 057bc7d commit 4750c1e

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/test/ui/lint/unused_parens_json_suggestion.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// compile-flags: --error-format json
1212

13-
// ignore-windows (see Issue #44968)
14-
1513
// The output for humans should just highlight the whole span without showing
1614
// the suggested replacement, but we also want to test that suggested
1715
// replacement only removes one set of parentheses, rather than naïvely
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"message":"unnecessary parentheses around assigned value","code":null,"level":"warning","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":1014,"byte_end":1027,"line_start":24,"line_end":24,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"#[warn(unused_parens)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":1014,"byte_end":1027,"line_start":24,"line_end":24,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":"1 / (2 + 3)","expansion":null}],"children":[],"rendered":" let _a = 1 / (2 + 3);"}],"rendered":null}
1+
{"message":"unnecessary parentheses around assigned value","code":null,"level":"warning","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":976,"byte_end":989,"line_start":22,"line_end":22,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"#[warn(unused_parens)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":976,"byte_end":989,"line_start":22,"line_end":22,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":"1 / (2 + 3)","expansion":null}],"children":[],"rendered":" let _a = 1 / (2 + 3);"}],"rendered":null}

src/tools/compiletest/src/runtest.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -2378,8 +2378,15 @@ actual:\n\
23782378

23792379
fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String {
23802380
let parent_dir = self.testpaths.file.parent().unwrap();
2381-
let parent_dir_str = parent_dir.display().to_string();
2381+
let cflags = self.props.compile_flags.join(" ");
2382+
let parent_dir_str = if cflags.contains("--error-format json") {
2383+
parent_dir.display().to_string().replace("\\", "\\\\")
2384+
} else {
2385+
parent_dir.display().to_string()
2386+
};
2387+
23822388
let mut normalized = output.replace(&parent_dir_str, "$DIR")
2389+
.replace("\\\\", "\\") // denormalize for paths on windows
23832390
.replace("\\", "/") // normalize for paths on windows
23842391
.replace("\r\n", "\n") // normalize for linebreaks on windows
23852392
.replace("\t", "\\t"); // makes tabs visible

0 commit comments

Comments
 (0)