Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory name used by test_merged_config is not rust unique #4405

Closed
davidBar-On opened this issue Aug 30, 2020 · 1 comment · Fixed by #4409
Closed

Directory name used by test_merged_config is not rust unique #4405

davidBar-On opened this issue Aug 30, 2020 · 1 comment · Fixed by #4409
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors help wanted

Comments

@davidBar-On
Copy link
Contributor

test_merged_config() in confi.rs creates and uses folder name a, usually under /tmp directory. The problem is that /tmp/a is a commonly used for other purposes, and that can cause problems as happened to me in #4400. It would be better if a more rust unique name will be used instead of "a".

@calebcartwright calebcartwright added good first issue Issues up for grabs, also good candidates for new rustfmt contributors help wanted labels Sep 2, 2020
@calebcartwright
Copy link
Member

This can be addressed as simply as changing the parent directory name from a to something a bit more unique in:

rustfmt/src/config.rs

Lines 644 to 680 in 334e297

#[test]
fn test_merged_config() {
match option_env!("CFG_RELEASE_CHANNEL") {
// this test requires nightly
None | Some("nightly") => {
let _outer_config = make_temp_file(
"a/rustfmt.toml",
r#"
tab_spaces = 2
fn_call_width = 50
ignore = ["b/main.rs", "util.rs"]
"#,
);
let inner_config = make_temp_file(
"a/b/rustfmt.toml",
r#"
version = "two"
tab_spaces = 3
ignore = []
"#,
);
let inner_dir = inner_config.path.parent().unwrap();
let (config, paths) = load_config::<NullOptions>(Some(inner_dir), None).unwrap();
assert_eq!(config.tab_spaces(), 3);
assert_eq!(config.fn_call_width(), 50);
assert_eq!(config.ignore().to_string(), r#"["main.rs"]"#);
let paths = paths.unwrap();
assert!(paths[0].ends_with("a/rustfmt.toml"));
assert!(paths[1].ends_with("a/b/rustfmt.toml"));
}
_ => {}
};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants