Skip to content

Commit f945bed

Browse files
authored
Merge pull request #80 from rust-lang/pa-fix-test
Fix test failure in the purge_caches test
2 parents a27fce6 + eed5ec3 commit f945bed

File tree

12 files changed

+14
-21
lines changed

12 files changed

+14
-21
lines changed

src/cmd/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ impl<'w, 'pl> Command<'w, 'pl> {
465465
crate::utils::normalize_path(rustup_home.as_ref()),
466466
);
467467
}
468-
for &(ref k, ref v) in &self.env {
468+
for (k, v) in &self.env {
469469
cmd.env(k, v);
470470
}
471471

src/cmd/process_lines_actions.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
use std::default::Default;
22

33
#[cfg_attr(test, derive(Debug, PartialEq))]
4+
#[derive(Default)]
45
pub(super) enum InnerState {
56
Removed,
7+
#[default]
68
Original,
79
Replaced(Vec<String>),
810
}
911

10-
impl Default for InnerState {
11-
fn default() -> Self {
12-
InnerState::Original
13-
}
14-
}
15-
1612
/// Represents actions that are available while reading live output from a process.
1713
///
1814
/// This will be available inside the function you provide to [`Command::process_lines`](struct.Command.html#method.process_lines)

src/cmd/sandbox.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl SandboxBuilder {
240240
}
241241
}
242242

243-
for &(ref var, ref value) in &self.env {
243+
for (var, value) in &self.env {
244244
args.push("-e".into());
245245
args.push(format! {"{}={}", var, value})
246246
}

src/crates/registry.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl CrateTrait for RegistryCrate {
165165

166166
workspace
167167
.http_client()
168-
.get(&self.fetch_url(workspace)?)
168+
.get(self.fetch_url(workspace)?)
169169
.send()?
170170
.error_for_status()?
171171
.write_to(&mut BufWriter::new(File::create(&local)?))?;
@@ -230,7 +230,7 @@ fn unpack_without_first_dir<R: Read>(archive: &mut Archive<R>, path: &Path) -> R
230230
let mut components = relpath.components();
231231
// Throw away the first path component
232232
components.next();
233-
let full_path = path.join(&components.as_path());
233+
let full_path = path.join(components.as_path());
234234
if let Some(parent) = full_path.parent() {
235235
std::fs::create_dir_all(parent)?;
236236
}

src/inside_docker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub(crate) fn probe_container_id(workspace: &Workspace) -> Result<Option<String>
6969
.log_output(false)
7070
.log_command(false)
7171
.run_capture();
72-
if let Ok(&[ref probed]) = res.as_ref().map(|out| out.stdout_lines()) {
72+
if let Ok([probed]) = res.as_ref().map(|out| out.stdout_lines()) {
7373
if *probed == probe_content {
7474
info!("probe successful, this is container ID {}", id);
7575
return Ok(Some(id.clone()));

src/native/unix.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mod tests {
7373
#[test]
7474
fn test_kill_process() {
7575
// Try to kill a sleep command
76-
let mut cmd = Command::new("sleep").args(&["2"]).spawn().unwrap();
76+
let mut cmd = Command::new("sleep").args(["2"]).spawn().unwrap();
7777
super::kill_process(cmd.id()).unwrap();
7878

7979
// Ensure it was killed with SIGKILL

src/prepare.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<'a> Prepare<'a> {
141141
let mut missing_deps = false;
142142
let res = Command::new(self.workspace, self.toolchain.cargo())
143143
.args(&["fetch", "--manifest-path", "Cargo.toml"])
144-
.cd(&self.source_dir)
144+
.cd(self.source_dir)
145145
.process_lines(&mut |line, _| {
146146
if line.contains("failed to load source for dependency") {
147147
missing_deps = true;

src/toolchain.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,7 @@ mod tests {
595595
// Create a fake rustup-installed toolchain
596596
std::fs::create_dir_all(rustup_home.path().join("toolchains").join(DIST_NAME))?;
597597
std::fs::create_dir_all(rustup_home.path().join("update-hashes"))?;
598-
std::fs::write(
599-
rustup_home.path().join("update-hashes").join(DIST_NAME),
600-
&[],
601-
)?;
598+
std::fs::write(rustup_home.path().join("update-hashes").join(DIST_NAME), [])?;
602599

603600
// Create a fake symlinked toolchain
604601
#[cfg(unix)]

src/tools/rustup.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Tool for Rustup {
4444
);
4545
let mut resp = workspace
4646
.http_client()
47-
.get(&url)
47+
.get(url)
4848
.send()?
4949
.error_for_status()?;
5050

src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn strip_verbatim_from_prefix(prefix: &PrefixComponent<'_>) -> Option<PathBuf> {
6868
}
6969

7070
pub(crate) fn remove_file(path: &Path) -> std::io::Result<()> {
71-
std::fs::remove_file(&path).map_err(|error| crate::utils::improve_remove_error(error, path))
71+
std::fs::remove_file(path).map_err(|error| crate::utils::improve_remove_error(error, path))
7272
}
7373

7474
pub(crate) fn remove_dir_all(path: &Path) -> std::io::Result<()> {

tests/buildtest/inside_docker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn execute(test: &str) -> Result<(), Error> {
4343
.arg("-v")
4444
.arg(docker_sock)
4545
.arg("-w")
46-
.arg(&container_prefix)
46+
.arg(container_prefix)
4747
.arg("-e")
4848
.arg("RUST_BACKTRACE=1")
4949
.arg("-e")

tests/integration/purge_caches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn test_purge_caches() -> Result<(), Error> {
2121
let start_contents = WorkspaceContents::collect(&workspace_path)?;
2222

2323
let crates = vec![
24-
Crate::crates_io("lazy_static", "1.0.0"),
24+
Crate::crates_io("lazy_static", "1.4.0"),
2525
Crate::git("https://github.com/pietroalbini/git-credential-null"),
2626
];
2727

0 commit comments

Comments
 (0)