Skip to content

cargotest: fix clippy warnings #75795

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

Merged
merged 1 commit into from
Aug 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/tools/cargotest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct Test {
packages: &'static [&'static str],
}

const TEST_REPOS: &'static [Test] = &[
const TEST_REPOS: &[Test] = &[
Test {
name: "iron",
repo: "https://github.com/iron/iron",
Expand Down Expand Up @@ -53,9 +53,9 @@ const TEST_REPOS: &'static [Test] = &[

fn main() {
let args = env::args().collect::<Vec<_>>();
let ref cargo = args[1];
let cargo = &args[1];
let out_dir = Path::new(&args[2]);
let ref cargo = Path::new(cargo);
let cargo = &Path::new(cargo);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path::new returns a &Path already

Suggested change
let cargo = &Path::new(cargo);
let cargo = Path::new(cargo);


for test in TEST_REPOS.iter().rev() {
test_repo(cargo, out_dir, test);
Expand All @@ -77,7 +77,7 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
let out_dir = out_dir.join(test.name);

if !out_dir.join(".git").is_dir() {
let status = Command::new("git").arg("init").arg(&out_dir).status().expect("");
let status = Command::new("git").arg("init").arg(&out_dir).status().unwrap();
assert!(status.success());
}

Expand All @@ -92,7 +92,7 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
.arg(&format!("--depth={}", depth))
.current_dir(&out_dir)
.status()
.expect("");
.unwrap();
assert!(status.success());
}

Expand All @@ -102,7 +102,7 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
.arg("--hard")
.current_dir(&out_dir)
.status()
.expect("");
.unwrap();

if status.success() {
found = true;
Expand Down Expand Up @@ -133,7 +133,7 @@ fn run_cargo_test(cargo_path: &Path, crate_path: &Path, packages: &[&str]) -> bo
.env("RUSTFLAGS", "--cap-lints warn")
.current_dir(crate_path)
.status()
.expect("");
.unwrap();

status.success()
}