diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2025-08-02 16:12:56 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-08-02 16:17:45 +0800 |
| commit | a97d0aabc8bbaeff1aff88df67bc99e8c778ba06 (patch) | |
| tree | 9e9537005a7f2a122c5b731e566a6480f892c502 /src | |
| parent | a71428825a3322d2662efdc4299f9cfac3e3f5e5 (diff) | |
| download | rust-a97d0aabc8bbaeff1aff88df67bc99e8c778ba06.tar.gz rust-a97d0aabc8bbaeff1aff88df67bc99e8c778ba06.zip | |
Make `issues_txt_header` a const
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/ui_tests.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 98a6b466ae9..6c83764cc19 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,12 +7,12 @@ use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; -pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { - let issues_txt_header = r#"============================================================ +const ISSUES_TXT_HEADER: &str = r#"============================================================ ⚠️⚠️⚠️NOTHING SHOULD EVER BE ADDED TO THIS LIST⚠️⚠️⚠️ ============================================================ "#; +pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { let path = &root_path.join("tests"); // the list of files in ui tests that are allowed to start with `issue-XXXX` @@ -20,7 +20,7 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { let mut prev_line = ""; let mut is_sorted = true; let allowed_issue_names: BTreeSet<_> = include_str!("issues.txt") - .strip_prefix(issues_txt_header) + .strip_prefix(ISSUES_TXT_HEADER) .unwrap() .lines() .inspect(|&line| { @@ -78,7 +78,7 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { // so we don't bork things on panic or a contributor using Ctrl+C let blessed_issues_path = tidy_src.join("issues_blessed.txt"); let mut blessed_issues_txt = fs::File::create(&blessed_issues_path).unwrap(); - blessed_issues_txt.write_all(issues_txt_header.as_bytes()).unwrap(); + blessed_issues_txt.write_all(ISSUES_TXT_HEADER.as_bytes()).unwrap(); // If we changed paths to use the OS separator, reassert Unix chauvinism for blessing. for filename in allowed_issue_names.difference(&remaining_issue_names) { writeln!(blessed_issues_txt, "{filename}").unwrap(); |
