Skip to content

Commit 677a180

Browse files
committed
Auto merge of #7106 - lukaslueg:master, r=ehuss
Update dependencies This removes the `byteorder`-dependency, which was used in a few tests only anyway and is not needed since 1.32; also removes the `derive`-feature from the `failure`-crate, which is not needed also.
2 parents 644c808 + 91186e8 commit 677a180

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ path = "src/cargo/lib.rs"
1919

2020
[dependencies]
2121
atty = "0.2"
22-
byteorder = "1.2"
2322
bytesize = "1.0"
2423
crates-io = { path = "crates/crates-io", version = "0.27" }
2524
crossbeam-utils = "0.6"

tests/testsuite/support/publish.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
use std::collections::{HashMap, HashSet};
22
use std::fs::File;
3-
use std::io::{prelude::*, SeekFrom};
3+
use std::io::{self, prelude::*, SeekFrom};
44
use std::path::{Path, PathBuf};
55

66
use crate::support::find_json_mismatch;
77
use crate::support::registry::{self, alt_api_path};
88

9-
use byteorder::{LittleEndian, ReadBytesExt};
109
use flate2::read::GzDecoder;
1110
use tar::Archive;
1211

12+
fn read_le_u32<R>(mut reader: R) -> io::Result<u32>
13+
where
14+
R: Read,
15+
{
16+
let mut buf = [0; 4];
17+
reader.read_exact(&mut buf)?;
18+
Ok(u32::from_le_bytes(buf))
19+
}
20+
1321
/// Checks the result of a crate publish.
1422
pub fn validate_upload(expected_json: &str, expected_crate_name: &str, expected_files: &[&str]) {
1523
let new_path = registry::api_path().join("api/v1/crates/new");
@@ -44,7 +52,7 @@ fn _validate_upload(
4452
) {
4553
let mut f = File::open(new_path).unwrap();
4654
// 32-bit little-endian integer of length of JSON data.
47-
let json_sz = f.read_u32::<LittleEndian>().expect("read json length");
55+
let json_sz = read_le_u32(&mut f).expect("read json length");
4856
let mut json_bytes = vec![0; json_sz as usize];
4957
f.read_exact(&mut json_bytes).expect("read JSON data");
5058
let actual_json = serde_json::from_slice(&json_bytes).expect("uploaded JSON should be valid");
@@ -53,7 +61,7 @@ fn _validate_upload(
5361
.expect("uploaded JSON did not match expected JSON");
5462

5563
// 32-bit little-endian integer of length of crate file.
56-
let crate_sz = f.read_u32::<LittleEndian>().expect("read crate length");
64+
let crate_sz = read_le_u32(&mut f).expect("read crate length");
5765
let mut krate_bytes = vec![0; crate_sz as usize];
5866
f.read_exact(&mut krate_bytes).expect("read crate data");
5967
// Check at end.

0 commit comments

Comments
 (0)