Skip to content

Commit a97d0aa

Browse files
committed
Make issues_txt_header a const
1 parent a714288 commit a97d0aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tools/tidy/src/ui_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ use std::fs;
77
use std::io::Write;
88
use std::path::{Path, PathBuf};
99

10-
pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
11-
let issues_txt_header = r#"============================================================
10+
const ISSUES_TXT_HEADER: &str = r#"============================================================
1211
⚠️⚠️⚠️NOTHING SHOULD EVER BE ADDED TO THIS LIST⚠️⚠️⚠️
1312
============================================================
1413
"#;
1514

15+
pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
1616
let path = &root_path.join("tests");
1717

1818
// the list of files in ui tests that are allowed to start with `issue-XXXX`
1919
// BTreeSet because we would like a stable ordering so --bless works
2020
let mut prev_line = "";
2121
let mut is_sorted = true;
2222
let allowed_issue_names: BTreeSet<_> = include_str!("issues.txt")
23-
.strip_prefix(issues_txt_header)
23+
.strip_prefix(ISSUES_TXT_HEADER)
2424
.unwrap()
2525
.lines()
2626
.inspect(|&line| {
@@ -78,7 +78,7 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
7878
// so we don't bork things on panic or a contributor using Ctrl+C
7979
let blessed_issues_path = tidy_src.join("issues_blessed.txt");
8080
let mut blessed_issues_txt = fs::File::create(&blessed_issues_path).unwrap();
81-
blessed_issues_txt.write_all(issues_txt_header.as_bytes()).unwrap();
81+
blessed_issues_txt.write_all(ISSUES_TXT_HEADER.as_bytes()).unwrap();
8282
// If we changed paths to use the OS separator, reassert Unix chauvinism for blessing.
8383
for filename in allowed_issue_names.difference(&remaining_issue_names) {
8484
writeln!(blessed_issues_txt, "{filename}").unwrap();

0 commit comments

Comments
 (0)