Skip to content

Commit ff57cc6

Browse files
refactor: rename some private whitelist names (#4326)
1 parent 7533cff commit ff57cc6

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/formatting/overflow.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const SHORT_ITEM_THRESHOLD: usize = 10;
3636
/// Organized as a list of `(&str, usize)` tuples, giving the name of the macro and the number of
3737
/// arguments before the format string (none for `format!("format", ...)`, one for `assert!(result,
3838
/// "format", ...)`, two for `assert_eq!(left, right, "format", ...)`).
39-
const SPECIAL_MACRO_WHITELIST: &[(&str, usize)] = &[
39+
const SPECIAL_CASE_MACROS: &[(&str, usize)] = &[
4040
// format! like macros
4141
// From the Rust Standard Library.
4242
("eprint!", 0),
@@ -64,7 +64,7 @@ const SPECIAL_MACRO_WHITELIST: &[(&str, usize)] = &[
6464
("debug_assert_ne!", 2),
6565
];
6666

67-
const SPECIAL_ATTR_WHITELIST: &[(&str, usize)] = &[
67+
const SPECIAL_CASE_ATTR: &[(&str, usize)] = &[
6868
// From the `failure` crate.
6969
("fail", 0),
7070
];
@@ -190,10 +190,10 @@ impl<'a> OverflowableItem<'a> {
190190
}
191191
}
192192

193-
fn whitelist(&self) -> &'static [(&'static str, usize)] {
193+
fn special_cases(&self) -> &'static [(&'static str, usize)] {
194194
match self {
195-
OverflowableItem::MacroArg(..) => SPECIAL_MACRO_WHITELIST,
196-
OverflowableItem::NestedMetaItem(..) => SPECIAL_ATTR_WHITELIST,
195+
OverflowableItem::MacroArg(..) => SPECIAL_CASE_MACROS,
196+
OverflowableItem::NestedMetaItem(..) => SPECIAL_CASE_ATTR,
197197
_ => &[],
198198
}
199199
}
@@ -764,7 +764,7 @@ pub(crate) fn maybe_get_args_offset(
764764
) -> Option<(bool, usize)> {
765765
if let Some(&(_, num_args_before)) = args
766766
.get(0)?
767-
.whitelist()
767+
.special_cases()
768768
.iter()
769769
.find(|&&(s, _)| s == callee_str)
770770
{

src/test/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod configuration_snippet;
2222
const DIFF_CONTEXT_SIZE: usize = 3;
2323

2424
// A list of files on which we want to skip testing.
25-
const SKIP_FILE_WHITE_LIST: &[&str] = &[
25+
const FILE_SKIP_LIST: &[&str] = &[
2626
"issue-3434/no_entry.rs",
2727
"issue-3665/sub_mod.rs",
2828
// Testing for issue-3779
@@ -88,16 +88,16 @@ where
8888
.any(|c| c.zip(subpath.as_ref().components()).all(|(a, b)| a == b))
8989
}
9090

91-
fn is_file_skip(skip_file_white_list: &[&str], path: &Path) -> bool {
92-
skip_file_white_list
91+
fn is_file_skip(file_skip_list: &[&str], path: &Path) -> bool {
92+
file_skip_list
9393
.iter()
9494
.any(|file_path| is_subpath(path, file_path))
9595
}
9696

9797
// Returns a `Vec` containing `PathBuf`s of files with an `rs` extension in the
9898
// given path. The `recursive` argument controls if files from subdirectories
9999
// are also returned.
100-
fn get_test_files(path: &Path, recursive: bool, skip_file_white_list: &[&str]) -> Vec<PathBuf> {
100+
fn get_test_files(path: &Path, recursive: bool, file_skip_list: &[&str]) -> Vec<PathBuf> {
101101
assert!(path.exists(), "{} does not exist", path.display());
102102

103103
let mut files = vec![];
@@ -108,9 +108,9 @@ fn get_test_files(path: &Path, recursive: bool, skip_file_white_list: &[&str]) -
108108
let entry = entry.expect("couldn't get `DirEntry`");
109109
let path = entry.path();
110110
if path.is_dir() && recursive {
111-
files.append(&mut get_test_files(&path, recursive, skip_file_white_list));
111+
files.append(&mut get_test_files(&path, recursive, file_skip_list));
112112
} else if path.extension().map_or(false, |f| f == "rs")
113-
&& !is_file_skip(skip_file_white_list, &path)
113+
&& !is_file_skip(file_skip_list, &path)
114114
{
115115
files.push(path);
116116
}
@@ -184,7 +184,7 @@ fn system_tests() {
184184
init_log();
185185
run_test_with(&TestSetting::default(), || {
186186
// Get all files in the tests/source directory.
187-
let files = get_test_files(Path::new("tests/source"), true, SKIP_FILE_WHITE_LIST);
187+
let files = get_test_files(Path::new("tests/source"), true, FILE_SKIP_LIST);
188188
let (_reports, count, fails) = check_files(files, &None);
189189

190190
// Display results.
@@ -362,7 +362,7 @@ fn idempotence_tests() {
362362
return;
363363
}
364364
// Get all files in the tests/target directory.
365-
let files = get_test_files(Path::new("tests/target"), true, SKIP_FILE_WHITE_LIST);
365+
let files = get_test_files(Path::new("tests/target"), true, FILE_SKIP_LIST);
366366
let (_reports, count, fails) = check_files(files, &None);
367367

368368
// Display results.
@@ -385,8 +385,8 @@ fn self_tests() {
385385
if !is_nightly_channel!() {
386386
return;
387387
}
388-
let skip_file_white_list = ["target", "tests"];
389-
let files = get_test_files(Path::new("src"), true, &skip_file_white_list);
388+
let file_skip_list = ["target", "tests"];
389+
let files = get_test_files(Path::new("src"), true, &file_skip_list);
390390

391391
let (reports, count, fails) = check_files(files, &Some(PathBuf::from("rustfmt.toml")));
392392
let mut warnings = 0;

0 commit comments

Comments
 (0)