diff -Nru rust-byteorder-1.3.4/benches/bench.rs rust-byteorder-1.4.3/benches/bench.rs --- rust-byteorder-1.3.4/benches/bench.rs 2019-01-19 14:01:25.000000000 +0000 +++ rust-byteorder-1.4.3/benches/bench.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +1,15 @@ #![feature(test)] -extern crate byteorder; -extern crate rand; extern crate test; macro_rules! bench_num { - ($name:ident, $read:ident, $bytes:expr, $data:expr) => ( + ($name:ident, $read:ident, $bytes:expr, $data:expr) => { mod $name { - use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian}; - use super::test::Bencher; - use super::test::black_box as bb; + use byteorder::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; + use test::black_box as bb; + use test::Bencher; const NITER: usize = 100_000; @@ -43,14 +43,16 @@ }); } } - ); + }; ($ty:ident, $max:ident, - $read:ident, $write:ident, $size:expr, $data:expr) => ( + $read:ident, $write:ident, $size:expr, $data:expr) => { mod $ty { + use byteorder::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; use std::$ty; - use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian}; - use super::test::Bencher; - use super::test::black_box as bb; + use test::black_box as bb; + use test::Bencher; const NITER: usize = 100_000; @@ -117,7 +119,7 @@ }); } } - ); + }; } bench_num!(u16, MAX, read_u16, write_u16, 2, [1, 2]); @@ -127,8 +129,7 @@ bench_num!(u64, MAX, read_u64, write_u64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); bench_num!(i64, MAX, read_i64, write_i64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); bench_num!(f32, MAX, read_f32, write_f32, 4, [1, 2, 3, 4]); -bench_num!(f64, MAX, read_f64, write_f64, 8, - [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(f64, MAX, read_f64, write_f64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); bench_num!(uint_1, read_uint, 1, [1]); bench_num!(uint_2, read_uint, 2, [1, 2]); @@ -148,120 +149,115 @@ bench_num!(int_7, read_int, 7, [1, 2, 3, 4, 5, 6, 7]); bench_num!(int_8, read_int, 8, [1, 2, 3, 4, 5, 6, 7, 8]); -#[cfg(byteorder_i128)] -bench_num!(u128, MAX, read_u128, write_u128, - 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); -#[cfg(byteorder_i128)] -bench_num!(i128, MAX, read_i128, write_i128, - 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); - -#[cfg(byteorder_i128)] -bench_num!(uint128_1, read_uint128, - 1, [1]); -#[cfg(byteorder_i128)] -bench_num!(uint128_2, read_uint128, - 2, [1, 2]); -#[cfg(byteorder_i128)] -bench_num!(uint128_3, read_uint128, - 3, [1, 2, 3]); -#[cfg(byteorder_i128)] -bench_num!(uint128_4, read_uint128, - 4, [1, 2, 3, 4]); -#[cfg(byteorder_i128)] -bench_num!(uint128_5, read_uint128, - 5, [1, 2, 3, 4, 5]); -#[cfg(byteorder_i128)] -bench_num!(uint128_6, read_uint128, - 6, [1, 2, 3, 4, 5, 6]); -#[cfg(byteorder_i128)] -bench_num!(uint128_7, read_uint128, - 7, [1, 2, 3, 4, 5, 6, 7]); -#[cfg(byteorder_i128)] -bench_num!(uint128_8, read_uint128, - 8, [1, 2, 3, 4, 5, 6, 7, 8]); -#[cfg(byteorder_i128)] -bench_num!(uint128_9, read_uint128, - 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]); -#[cfg(byteorder_i128)] -bench_num!(uint128_10, read_uint128, - 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); -#[cfg(byteorder_i128)] -bench_num!(uint128_11, read_uint128, - 11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); -#[cfg(byteorder_i128)] -bench_num!(uint128_12, read_uint128, - 12, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); -#[cfg(byteorder_i128)] -bench_num!(uint128_13, read_uint128, - 13, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]); -#[cfg(byteorder_i128)] -bench_num!(uint128_14, read_uint128, - 14, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); -#[cfg(byteorder_i128)] -bench_num!(uint128_15, read_uint128, - 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); -#[cfg(byteorder_i128)] -bench_num!(uint128_16, read_uint128, - 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); - -#[cfg(byteorder_i128)] -bench_num!(int128_1, read_int128, - 1, [1]); -#[cfg(byteorder_i128)] -bench_num!(int128_2, read_int128, - 2, [1, 2]); -#[cfg(byteorder_i128)] -bench_num!(int128_3, read_int128, - 3, [1, 2, 3]); -#[cfg(byteorder_i128)] -bench_num!(int128_4, read_int128, - 4, [1, 2, 3, 4]); -#[cfg(byteorder_i128)] -bench_num!(int128_5, read_int128, - 5, [1, 2, 3, 4, 5]); -#[cfg(byteorder_i128)] -bench_num!(int128_6, read_int128, - 6, [1, 2, 3, 4, 5, 6]); -#[cfg(byteorder_i128)] -bench_num!(int128_7, read_int128, - 7, [1, 2, 3, 4, 5, 6, 7]); -#[cfg(byteorder_i128)] -bench_num!(int128_8, read_int128, - 8, [1, 2, 3, 4, 5, 6, 7, 8]); -#[cfg(byteorder_i128)] -bench_num!(int128_9, read_int128, - 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]); -#[cfg(byteorder_i128)] -bench_num!(int128_10, read_int128, - 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); -#[cfg(byteorder_i128)] -bench_num!(int128_11, read_int128, - 11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); -#[cfg(byteorder_i128)] -bench_num!(int128_12, read_int128, - 12, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); -#[cfg(byteorder_i128)] -bench_num!(int128_13, read_int128, - 13, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]); -#[cfg(byteorder_i128)] -bench_num!(int128_14, read_int128, - 14, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); -#[cfg(byteorder_i128)] -bench_num!(int128_15, read_int128, - 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); -#[cfg(byteorder_i128)] -bench_num!(int128_16, read_int128, - 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); - +bench_num!( + u128, + MAX, + read_u128, + write_u128, + 16, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] +); +bench_num!( + i128, + MAX, + read_i128, + write_i128, + 16, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] +); + +bench_num!(uint128_1, read_uint128, 1, [1]); +bench_num!(uint128_2, read_uint128, 2, [1, 2]); +bench_num!(uint128_3, read_uint128, 3, [1, 2, 3]); +bench_num!(uint128_4, read_uint128, 4, [1, 2, 3, 4]); +bench_num!(uint128_5, read_uint128, 5, [1, 2, 3, 4, 5]); +bench_num!(uint128_6, read_uint128, 6, [1, 2, 3, 4, 5, 6]); +bench_num!(uint128_7, read_uint128, 7, [1, 2, 3, 4, 5, 6, 7]); +bench_num!(uint128_8, read_uint128, 8, [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(uint128_9, read_uint128, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]); +bench_num!(uint128_10, read_uint128, 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); +bench_num!(uint128_11, read_uint128, 11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); +bench_num!( + uint128_12, + read_uint128, + 12, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +); +bench_num!( + uint128_13, + read_uint128, + 13, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] +); +bench_num!( + uint128_14, + read_uint128, + 14, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] +); +bench_num!( + uint128_15, + read_uint128, + 15, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] +); +bench_num!( + uint128_16, + read_uint128, + 16, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] +); + +bench_num!(int128_1, read_int128, 1, [1]); +bench_num!(int128_2, read_int128, 2, [1, 2]); +bench_num!(int128_3, read_int128, 3, [1, 2, 3]); +bench_num!(int128_4, read_int128, 4, [1, 2, 3, 4]); +bench_num!(int128_5, read_int128, 5, [1, 2, 3, 4, 5]); +bench_num!(int128_6, read_int128, 6, [1, 2, 3, 4, 5, 6]); +bench_num!(int128_7, read_int128, 7, [1, 2, 3, 4, 5, 6, 7]); +bench_num!(int128_8, read_int128, 8, [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(int128_9, read_int128, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]); +bench_num!(int128_10, read_int128, 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); +bench_num!(int128_11, read_int128, 11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); +bench_num!( + int128_12, + read_int128, + 12, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +); +bench_num!( + int128_13, + read_int128, + 13, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] +); +bench_num!( + int128_14, + read_int128, + 14, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] +); +bench_num!( + int128_15, + read_int128, + 15, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] +); +bench_num!( + int128_16, + read_int128, + 16, + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] +); macro_rules! bench_slice { ($name:ident, $numty:ty, $read:ident, $write:ident) => { mod $name { use std::mem::size_of; - use byteorder::{ByteOrder, BigEndian, LittleEndian}; - use rand::{self, Rng}; + use byteorder::{BigEndian, ByteOrder, LittleEndian}; use rand::distributions; + use rand::{self, Rng}; use test::Bencher; #[bench] @@ -322,7 +318,7 @@ }); } } - } + }; } bench_slice!(slice_u64, u64, read_u64_into, write_u64_into); diff -Nru rust-byteorder-1.3.4/build.rs rust-byteorder-1.4.3/build.rs --- rust-byteorder-1.3.4/build.rs 2020-02-07 13:16:00.000000000 +0000 +++ rust-byteorder-1.4.3/build.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -// For the 'try!' macro, until we bump MSRV past 1.12. -#![allow(deprecated)] - -use std::env; -use std::ffi::OsString; -use std::io::{self, Write}; -use std::process::Command; - -fn main() { - let version = match Version::read() { - Ok(version) => version, - Err(err) => { - writeln!( - &mut io::stderr(), - "failed to parse `rustc --version`: {}", - err - ).unwrap(); - return; - } - }; - enable_i128(version); -} - -fn enable_i128(version: Version) { - if version < (Version { major: 1, minor: 26, patch: 0 }) { - return; - } - - println!("cargo:rustc-cfg=byteorder_i128"); -} - -#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)] -struct Version { - major: u32, - minor: u32, - patch: u32, -} - -impl Version { - fn read() -> Result { - let rustc = env::var_os("RUSTC").unwrap_or(OsString::from("rustc")); - let output = Command::new(&rustc) - .arg("--version") - .output() - .unwrap() - .stdout; - Version::parse(&String::from_utf8(output).unwrap()) - } - - fn parse(mut s: &str) -> Result { - if !s.starts_with("rustc ") { - return Err(format!("unrecognized version string: {}", s)); - } - s = &s["rustc ".len()..]; - - let parts: Vec<&str> = s.split(".").collect(); - if parts.len() < 3 { - return Err(format!("not enough version parts: {:?}", parts)); - } - - let mut num = String::new(); - for c in parts[0].chars() { - if !c.is_digit(10) { - break; - } - num.push(c); - } - let major = try!(num.parse::().map_err(|e| e.to_string())); - - num.clear(); - for c in parts[1].chars() { - if !c.is_digit(10) { - break; - } - num.push(c); - } - let minor = try!(num.parse::().map_err(|e| e.to_string())); - - num.clear(); - for c in parts[2].chars() { - if !c.is_digit(10) { - break; - } - num.push(c); - } - let patch = try!(num.parse::().map_err(|e| e.to_string())); - - Ok(Version { major: major, minor: minor, patch: patch }) - } -} diff -Nru rust-byteorder-1.3.4/Cargo.toml rust-byteorder-1.4.3/Cargo.toml --- rust-byteorder-1.3.4/Cargo.toml 2020-02-07 13:18:00.000000000 +0000 +++ rust-byteorder-1.4.3/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -11,17 +11,17 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "byteorder" -version = "1.3.4" +version = "1.4.3" authors = ["Andrew Gallant "] -build = "build.rs" exclude = ["/ci/*"] description = "Library for reading/writing numbers in big-endian and little-endian." homepage = "https://github.com/BurntSushi/byteorder" documentation = "https://docs.rs/byteorder" readme = "README.md" keywords = ["byte", "endian", "big-endian", "little-endian", "binary"] -categories = ["encoding", "parsing"] +categories = ["encoding", "parsing", "no-std"] license = "Unlicense OR MIT" repository = "https://github.com/BurntSushi/byteorder" [profile.bench] @@ -30,19 +30,14 @@ [lib] name = "byteorder" bench = false -[dev-dependencies.doc-comment] -version = "0.3" - [dev-dependencies.quickcheck] -version = "0.8" +version = "0.9.2" default-features = false [dev-dependencies.rand] -version = "0.6" +version = "0.7" [features] default = ["std"] i128 = [] std = [] -[badges.travis-ci] -repository = "BurntSushi/byteorder" diff -Nru rust-byteorder-1.3.4/Cargo.toml.orig rust-byteorder-1.4.3/Cargo.toml.orig --- rust-byteorder-1.3.4/Cargo.toml.orig 2020-02-07 13:17:59.000000000 +0000 +++ rust-byteorder-1.4.3/Cargo.toml.orig 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +1,25 @@ [package] name = "byteorder" -version = "1.3.4" #:version +version = "1.4.3" #:version authors = ["Andrew Gallant "] description = "Library for reading/writing numbers in big-endian and little-endian." documentation = "https://docs.rs/byteorder" homepage = "https://github.com/BurntSushi/byteorder" repository = "https://github.com/BurntSushi/byteorder" readme = "README.md" -categories = ["encoding", "parsing"] +categories = ["encoding", "parsing", "no-std"] keywords = ["byte", "endian", "big-endian", "little-endian", "binary"] license = "Unlicense OR MIT" exclude = ["/ci/*"] -build = "build.rs" +edition = "2018" [lib] name = "byteorder" bench = false [dev-dependencies] -quickcheck = { version = "0.8", default-features = false } -rand = "0.6" -doc-comment = "0.3" +quickcheck = { version = "0.9.2", default-features = false } +rand = "0.7" [features] default = ["std"] @@ -33,6 +32,3 @@ [profile.bench] opt-level = 3 - -[badges] -travis-ci = { repository = "BurntSushi/byteorder" } diff -Nru rust-byteorder-1.3.4/.cargo_vcs_info.json rust-byteorder-1.4.3/.cargo_vcs_info.json --- rust-byteorder-1.3.4/.cargo_vcs_info.json 2020-02-07 13:18:00.000000000 +0000 +++ rust-byteorder-1.4.3/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +1,5 @@ { "git": { - "sha1": "eaaad370715c04d78334d6a5b49c637549c84c71" + "sha1": "abffade8232229db557e0a30c395963071624b2b" } } diff -Nru rust-byteorder-1.3.4/CHANGELOG.md rust-byteorder-1.4.3/CHANGELOG.md --- rust-byteorder-1.3.4/CHANGELOG.md 2019-01-19 14:01:25.000000000 +0000 +++ rust-byteorder-1.4.3/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +1,28 @@ +1.3.4 +===== +This patch release squashes deprecation warnings for the `try!` macro, in +accordance with byteorder's minimum supported Rust version (currently at Rust +1.12.0). + + +1.3.3 +===== +This patch release adds `ByteOrder::write_i8_into()` as a simple, safe interface +for ordinarily unsafe or tedious code. + + +1.3.2 +===== +This patch release adds `ReadBytesExt::read_i8_into()` as a simple, safe interface +for ordinarily unsafe or tedious code. + + +1.3.1 +===== +This minor release performs mostly small internal changes. Going forward, these +are not going to be incorporated into the changelog. + + 1.3.0 ===== This new minor release now enables `i128` support automatically on Rust diff -Nru rust-byteorder-1.3.4/debian/cargo-checksum.json rust-byteorder-1.4.3/debian/cargo-checksum.json --- rust-byteorder-1.3.4/debian/cargo-checksum.json 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/cargo-checksum.json 2021-08-29 16:50:50.000000000 +0000 @@ -1 +1 @@ -{"package":"Could not get crate checksum","files":{}} +{"package":"14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610","files":{}} diff -Nru rust-byteorder-1.3.4/debian/changelog rust-byteorder-1.4.3/debian/changelog --- rust-byteorder-1.3.4/debian/changelog 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/changelog 2021-08-29 16:50:50.000000000 +0000 @@ -1,3 +1,16 @@ +rust-byteorder (1.4.3-2) unstable; urgency=medium + + * Package byteorder 1.4.3 from crates.io using debcargo 2.4.4-alpha.0 + * Re-upload with dependency on dh-cargo >= 26 fixing mtime of changelog file + + -- Wolfgang Silbermayr Sun, 29 Aug 2021 18:50:50 +0200 + +rust-byteorder (1.4.3-1) unstable; urgency=medium + + * Package byteorder 1.4.3 from crates.io using debcargo 2.4.4-alpha.0 + + -- Wolfgang Silbermayr Sun, 29 Aug 2021 08:49:40 +0200 + rust-byteorder (1.3.4-1) unstable; urgency=medium * Package byteorder 1.3.4 from crates.io using debcargo 2.4.3 diff -Nru rust-byteorder-1.3.4/debian/compat rust-byteorder-1.4.3/debian/compat --- rust-byteorder-1.3.4/debian/compat 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/compat 2021-08-29 16:50:50.000000000 +0000 @@ -1 +1 @@ -11 +12 diff -Nru rust-byteorder-1.3.4/debian/control rust-byteorder-1.4.3/debian/control --- rust-byteorder-1.3.4/debian/control 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/control 2021-08-29 16:50:50.000000000 +0000 @@ -1,8 +1,8 @@ Source: rust-byteorder Section: rust Priority: optional -Build-Depends: debhelper (>= 11), - dh-cargo (>= 18), +Build-Depends: debhelper (>= 12), + dh-cargo (>= 26), cargo:native , rustc:native , libstd-rust-dev @@ -10,10 +10,11 @@ Uploaders: Ximin Luo , Wolfgang Silbermayr -Standards-Version: 4.4.1 +Standards-Version: 4.5.1 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/byteorder] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/byteorder Homepage: https://github.com/BurntSushi/byteorder +Rules-Requires-Root: no Package: librust-byteorder-dev Architecture: any @@ -28,14 +29,14 @@ librust-byteorder-1+default-dev (= ${binary:Version}), librust-byteorder-1+i128-dev (= ${binary:Version}), librust-byteorder-1+std-dev (= ${binary:Version}), - librust-byteorder-1.3-dev (= ${binary:Version}), - librust-byteorder-1.3+default-dev (= ${binary:Version}), - librust-byteorder-1.3+i128-dev (= ${binary:Version}), - librust-byteorder-1.3+std-dev (= ${binary:Version}), - librust-byteorder-1.3.4-dev (= ${binary:Version}), - librust-byteorder-1.3.4+default-dev (= ${binary:Version}), - librust-byteorder-1.3.4+i128-dev (= ${binary:Version}), - librust-byteorder-1.3.4+std-dev (= ${binary:Version}) + librust-byteorder-1.4-dev (= ${binary:Version}), + librust-byteorder-1.4+default-dev (= ${binary:Version}), + librust-byteorder-1.4+i128-dev (= ${binary:Version}), + librust-byteorder-1.4+std-dev (= ${binary:Version}), + librust-byteorder-1.4.3-dev (= ${binary:Version}), + librust-byteorder-1.4.3+default-dev (= ${binary:Version}), + librust-byteorder-1.4.3+i128-dev (= ${binary:Version}), + librust-byteorder-1.4.3+std-dev (= ${binary:Version}) Description: Reading/writing numbers in big-endian and little-endian - Rust source code This package contains the source for the Rust byteorder crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-byteorder-1.3.4/debian/copyright.debcargo.hint rust-byteorder-1.4.3/debian/copyright.debcargo.hint --- rust-byteorder-1.3.4/debian/copyright.debcargo.hint 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/copyright.debcargo.hint 2021-08-29 16:50:50.000000000 +0000 @@ -21,9 +21,9 @@ Files: debian/* Copyright: - 2018-2020 Debian Rust Maintainers - 2018-2020 Ximin Luo - 2018-2020 Wolfgang Silbermayr + 2018-2021 Debian Rust Maintainers + 2018-2021 Ximin Luo + 2018-2021 Wolfgang Silbermayr License: Unlicense or MIT License: MIT diff -Nru rust-byteorder-1.3.4/debian/patches/relax-dep.diff rust-byteorder-1.4.3/debian/patches/relax-dep.diff --- rust-byteorder-1.3.4/debian/patches/relax-dep.diff 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/patches/relax-dep.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -34,11 +34,11 @@ - version = "0.3" - - [dev-dependencies.quickcheck] --version = "0.8" -+version = ">= 0.8, < 0.10" - default-features = false - - [dev-dependencies.rand] --version = "0.6" -+version = ">= 0.6, < 0.8" - - [features] - default = ["std"] diff -Nru rust-byteorder-1.3.4/debian/patches/series rust-byteorder-1.4.3/debian/patches/series --- rust-byteorder-1.3.4/debian/patches/series 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -relax-dep.diff diff -Nru rust-byteorder-1.3.4/debian/tests/control rust-byteorder-1.4.3/debian/tests/control --- rust-byteorder-1.3.4/debian/tests/control 2020-06-16 19:07:15.000000000 +0000 +++ rust-byteorder-1.4.3/debian/tests/control 2021-08-29 16:50:50.000000000 +0000 @@ -1,9 +1,24 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.3.4 --all-targets --all-features -Features: test-name=@ -Depends: dh-cargo (>= 18), librust-doc-comment-0.3+default-dev, librust-quickcheck-0.9-dev | librust-quickcheck-0.8-dev, librust-rand-0.7+default-dev | librust-rand-0.6+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.4.3 --all-targets --all-features +Features: test-name=rust-byteorder:@ +Depends: dh-cargo (>= 18), librust-quickcheck-0.9-dev (>= 0.9.2-~~), librust-rand-0.7+default-dev, @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.3.4 --all-targets --no-default-features -Features: test-name=librust-byteorder-dev -Depends: dh-cargo (>= 18), librust-doc-comment-0.3+default-dev, librust-quickcheck-0.9-dev | librust-quickcheck-0.8-dev, librust-rand-0.7+default-dev | librust-rand-0.6+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.4.3 --all-targets +Features: test-name=librust-byteorder-dev:default +Depends: dh-cargo (>= 18), librust-quickcheck-0.9-dev (>= 0.9.2-~~), librust-rand-0.7+default-dev, @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.4.3 --all-targets --no-default-features --features i128 +Features: test-name=librust-byteorder-dev:i128 +Depends: dh-cargo (>= 18), librust-quickcheck-0.9-dev (>= 0.9.2-~~), librust-rand-0.7+default-dev, @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.4.3 --all-targets --no-default-features --features std +Features: test-name=librust-byteorder-dev:std +Depends: dh-cargo (>= 18), librust-quickcheck-0.9-dev (>= 0.9.2-~~), librust-rand-0.7+default-dev, @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test byteorder 1.4.3 --all-targets --no-default-features +Features: test-name=librust-byteorder-dev: +Depends: dh-cargo (>= 18), librust-quickcheck-0.9-dev (>= 0.9.2-~~), librust-rand-0.7+default-dev, @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-byteorder-1.3.4/.github/workflows/ci.yml rust-byteorder-1.4.3/.github/workflows/ci.yml --- rust-byteorder-1.3.4/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ rust-byteorder-1.4.3/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,151 @@ +name: ci +on: + pull_request: + push: + branches: + - master + schedule: + - cron: '00 01 * * *' +jobs: + test: + name: test + env: + # For some builds, we use cross to test on 32-bit and big-endian + # systems. + CARGO: cargo + # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`. + TARGET: + runs-on: ${{ matrix.os }} + strategy: + matrix: + build: + - pinned + - stable + - stable-32 + - stable-mips + - beta + - nightly + - macos + - win-msvc + - win-gnu + include: + - build: pinned + os: ubuntu-18.04 + rust: 1.41.1 + - build: stable + os: ubuntu-18.04 + rust: stable + - build: stable-32 + os: ubuntu-18.04 + rust: stable + target: i686-unknown-linux-gnu + - build: stable-mips + os: ubuntu-18.04 + rust: stable + target: mips64-unknown-linux-gnuabi64 + - build: beta + os: ubuntu-18.04 + rust: beta + - build: nightly + os: ubuntu-18.04 + rust: nightly + - build: macos + os: macos-latest + rust: stable + - build: win-msvc + os: windows-2019 + rust: stable + - build: win-gnu + os: windows-2019 + rust: stable-x86_64-gnu + steps: + - name: Checkout repository + uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + profile: minimal + override: true + + - name: Use Cross + if: matrix.target != '' + run: | + # FIXME: to work around bugs in latest cross release, install master. + # See: https://github.com/rust-embedded/cross/issues/357 + cargo install --git https://github.com/rust-embedded/cross + echo "CARGO=cross" >> $GITHUB_ENV + echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV + + - name: Show command used for Cargo + run: | + echo "cargo command is: ${{ env.CARGO }}" + echo "target flag is: ${{ env.TARGET }}" + + - name: Show CPU info for debugging + if: matrix.os == 'ubuntu-18.04' + run: lscpu + + - name: Build + run: ${{ env.CARGO }} build --verbose $TARGET + + - name: Build (no default) + run: ${{ env.CARGO }} build --verbose $TARGET --no-default-features + + - name: Build docs + run: ${{ env.CARGO }} doc --verbose $TARGET + + # Our dev dependencies evolve more rapidly than we'd like, so only run + # tests when we aren't pinning the Rust version. + - name: Tests + if: matrix.build != 'pinned' + run: ${{ env.CARGO }} test --verbose $TARGET + + - name: Tests (no default, lib only) + if: matrix.build != 'pinned' + run: ${{ env.CARGO }} test --verbose --no-default-features --lib $TARGET + + - name: Tests (i128) + if: matrix.build != 'pinned' + run: ${{ env.CARGO }} test --verbose --features i128 $TARGET + + - name: Tests (no default, lib only, i128) + if: matrix.build != 'pinned' + run: ${{ env.CARGO }} test --verbose --no-default-features --features i128 --lib $TARGET + + - name: Compile benchmarks + if: matrix.build == 'nightly' + run: cargo bench --verbose --no-run $TARGET + + - name: Compile benchmarks (no default) + if: matrix.build == 'nightly' + run: cargo bench --verbose --no-run --no-default-features $TARGET + + - name: Compile benchmarks (i128) + if: matrix.build == 'nightly' + run: cargo bench --verbose --no-run --features i128 $TARGET + + - name: Compile benchmarks (no default, i128) + if: matrix.build == 'nightly' + run: cargo bench --verbose --no-run --no-default-features --features i128 $TARGET + + rustfmt: + name: rustfmt + runs-on: ubuntu-18.04 + steps: + - name: Checkout repository + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + components: rustfmt + - name: Check formatting + run: cargo fmt -- --check diff -Nru rust-byteorder-1.3.4/README.md rust-byteorder-1.4.3/README.md --- rust-byteorder-1.3.4/README.md 2019-06-09 13:40:43.000000000 +0000 +++ rust-byteorder-1.4.3/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +1,12 @@ +byteorder +========= This crate provides convenience methods for encoding and decoding numbers in either big-endian or little-endian order. -[![Build status](https://api.travis-ci.org/BurntSushi/byteorder.svg)](https://travis-ci.org/BurntSushi/byteorder) -[![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder) +[![Build status](https://github.com/BurntSushi/byteorder/workflows/ci/badge.svg)](https://github.com/BurntSushi/byteorder/actions) +[![](https://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder) -Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). +Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/). ### Documentation @@ -27,8 +29,6 @@ extension methods like so: ```rust -extern crate byteorder; - use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; ``` diff -Nru rust-byteorder-1.3.4/rustfmt.toml rust-byteorder-1.4.3/rustfmt.toml --- rust-byteorder-1.3.4/rustfmt.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-byteorder-1.4.3/rustfmt.toml 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,2 @@ +max_width = 79 +use_small_heuristics = "max" diff -Nru rust-byteorder-1.3.4/src/io.rs rust-byteorder-1.4.3/src/io.rs --- rust-byteorder-1.3.4/src/io.rs 2020-02-07 13:17:09.000000000 +0000 +++ rust-byteorder-1.4.3/src/io.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +1,9 @@ -use std::io::{self, Result}; -use std::slice; +use std::{ + io::{self, Result}, + slice, +}; -use ByteOrder; +use crate::ByteOrder; /// Extends [`Read`] with methods for reading numbers. (For `std::io`.) /// @@ -52,7 +54,7 @@ #[inline] fn read_u8(&mut self) -> Result { let mut buf = [0; 1]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(buf[0]) } @@ -82,7 +84,7 @@ #[inline] fn read_i8(&mut self) -> Result { let mut buf = [0; 1]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(buf[0] as i8) } @@ -109,7 +111,7 @@ #[inline] fn read_u16(&mut self) -> Result { let mut buf = [0; 2]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_u16(&buf)) } @@ -136,7 +138,7 @@ #[inline] fn read_i16(&mut self) -> Result { let mut buf = [0; 2]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_i16(&buf)) } @@ -162,7 +164,7 @@ #[inline] fn read_u24(&mut self) -> Result { let mut buf = [0; 3]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_u24(&buf)) } @@ -188,7 +190,7 @@ #[inline] fn read_i24(&mut self) -> Result { let mut buf = [0; 3]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_i24(&buf)) } @@ -214,7 +216,7 @@ #[inline] fn read_u32(&mut self) -> Result { let mut buf = [0; 4]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_u32(&buf)) } @@ -240,7 +242,7 @@ #[inline] fn read_i32(&mut self) -> Result { let mut buf = [0; 4]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_i32(&buf)) } @@ -266,7 +268,7 @@ #[inline] fn read_u48(&mut self) -> Result { let mut buf = [0; 6]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_u48(&buf)) } @@ -292,7 +294,7 @@ #[inline] fn read_i48(&mut self) -> Result { let mut buf = [0; 6]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_i48(&buf)) } @@ -318,7 +320,7 @@ #[inline] fn read_u64(&mut self) -> Result { let mut buf = [0; 8]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_u64(&buf)) } @@ -344,7 +346,7 @@ #[inline] fn read_i64(&mut self) -> Result { let mut buf = [0; 8]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_i64(&buf)) } @@ -370,11 +372,10 @@ /// ]); /// assert_eq!(16947640962301618749969007319746179, rdr.read_u128::().unwrap()); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_u128(&mut self) -> Result { let mut buf = [0; 16]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_u128(&buf)) } @@ -397,11 +398,10 @@ /// let mut rdr = Cursor::new(vec![0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); /// assert_eq!(i128::min_value(), rdr.read_i128::().unwrap()); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_i128(&mut self) -> Result { let mut buf = [0; 16]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_i128(&buf)) } @@ -426,7 +426,7 @@ #[inline] fn read_uint(&mut self, nbytes: usize) -> Result { let mut buf = [0; 8]; - try!(self.read_exact(&mut buf[..nbytes])); + self.read_exact(&mut buf[..nbytes])?; Ok(T::read_uint(&buf[..nbytes], nbytes)) } @@ -451,25 +451,23 @@ #[inline] fn read_int(&mut self, nbytes: usize) -> Result { let mut buf = [0; 8]; - try!(self.read_exact(&mut buf[..nbytes])); + self.read_exact(&mut buf[..nbytes])?; Ok(T::read_int(&buf[..nbytes], nbytes)) } /// Reads an unsigned n-bytes integer from the underlying reader. - #[cfg(byteorder_i128)] #[inline] fn read_uint128(&mut self, nbytes: usize) -> Result { let mut buf = [0; 16]; - try!(self.read_exact(&mut buf[..nbytes])); + self.read_exact(&mut buf[..nbytes])?; Ok(T::read_uint128(&buf[..nbytes], nbytes)) } /// Reads a signed n-bytes integer from the underlying reader. - #[cfg(byteorder_i128)] #[inline] fn read_int128(&mut self, nbytes: usize) -> Result { let mut buf = [0; 16]; - try!(self.read_exact(&mut buf[..nbytes])); + self.read_exact(&mut buf[..nbytes])?; Ok(T::read_int128(&buf[..nbytes], nbytes)) } @@ -500,7 +498,7 @@ #[inline] fn read_f32(&mut self) -> Result { let mut buf = [0; 4]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_f32(&buf)) } @@ -531,7 +529,7 @@ #[inline] fn read_f64(&mut self) -> Result { let mut buf = [0; 8]; - try!(self.read_exact(&mut buf)); + self.read_exact(&mut buf)?; Ok(T::read_f64(&buf)) } @@ -564,7 +562,7 @@ fn read_u16_into(&mut self, dst: &mut [u16]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_u16(dst); Ok(()) @@ -599,7 +597,7 @@ fn read_u32_into(&mut self, dst: &mut [u32]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_u32(dst); Ok(()) @@ -637,7 +635,7 @@ fn read_u64_into(&mut self, dst: &mut [u64]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_u64(dst); Ok(()) @@ -671,7 +669,6 @@ /// rdr.read_u128_into::(&mut dst).unwrap(); /// assert_eq!([517, 768], dst); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_u128_into( &mut self, @@ -679,7 +676,7 @@ ) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_u128(dst); Ok(()) @@ -750,7 +747,7 @@ fn read_i16_into(&mut self, dst: &mut [i16]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_i16(dst); Ok(()) @@ -785,7 +782,7 @@ fn read_i32_into(&mut self, dst: &mut [i32]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_i32(dst); Ok(()) @@ -823,7 +820,7 @@ fn read_i64_into(&mut self, dst: &mut [i64]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_i64(dst); Ok(()) @@ -857,7 +854,6 @@ /// rdr.read_i128_into::(&mut dst).unwrap(); /// assert_eq!([517, 768], dst); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_i128_into( &mut self, @@ -865,7 +861,7 @@ ) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_i128(dst); Ok(()) @@ -903,13 +899,10 @@ /// assert_eq!([f32::consts::PI, 1.0], dst); /// ``` #[inline] - fn read_f32_into( - &mut self, - dst: &mut [f32], - ) -> Result<()> { + fn read_f32_into(&mut self, dst: &mut [f32]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_f32(dst); Ok(()) @@ -951,7 +944,7 @@ /// assert_eq!([f32::consts::PI, 1.0], dst); /// ``` #[inline] - #[deprecated(since="1.2.0", note="please use `read_f32_into` instead")] + #[deprecated(since = "1.2.0", note = "please use `read_f32_into` instead")] fn read_f32_into_unchecked( &mut self, dst: &mut [f32], @@ -991,13 +984,10 @@ /// assert_eq!([f64::consts::PI, 1.0], dst); /// ``` #[inline] - fn read_f64_into( - &mut self, - dst: &mut [f64], - ) -> Result<()> { + fn read_f64_into(&mut self, dst: &mut [f64]) -> Result<()> { { let buf = unsafe { slice_to_u8_mut(dst) }; - try!(self.read_exact(buf)); + self.read_exact(buf)?; } T::from_slice_f64(dst); Ok(()) @@ -1045,7 +1035,7 @@ /// assert_eq!([f64::consts::PI, 1.0], dst); /// ``` #[inline] - #[deprecated(since="1.2.0", note="please use `read_f64_into` instead")] + #[deprecated(since = "1.2.0", note = "please use `read_f64_into` instead")] fn read_f64_into_unchecked( &mut self, dst: &mut [f64], @@ -1408,7 +1398,6 @@ } /// Writes an unsigned 128 bit integer to the underlying writer. - #[cfg(byteorder_i128)] #[inline] fn write_u128(&mut self, n: u128) -> Result<()> { let mut buf = [0; 16]; @@ -1417,7 +1406,6 @@ } /// Writes a signed 128 bit integer to the underlying writer. - #[cfg(byteorder_i128)] #[inline] fn write_i128(&mut self, n: i128) -> Result<()> { let mut buf = [0; 16]; @@ -1501,7 +1489,6 @@ /// /// If the given integer is not representable in the given number of bytes, /// this method panics. If `nbytes > 16`, this method panics. - #[cfg(byteorder_i128)] #[inline] fn write_uint128( &mut self, @@ -1517,7 +1504,6 @@ /// /// If the given integer is not representable in the given number of bytes, /// this method panics. If `nbytes > 16`, this method panics. - #[cfg(byteorder_i128)] #[inline] fn write_int128( &mut self, @@ -1596,7 +1582,8 @@ /// representation. /// /// This function is wildly unsafe because it permits arbitrary modification of -/// the binary representation of any `Copy` type. Use with care. +/// the binary representation of any `Copy` type. Use with care. It's intended +/// to be called only where `T` is a numeric type. unsafe fn slice_to_u8_mut(slice: &mut [T]) -> &mut [u8] { use std::mem::size_of; diff -Nru rust-byteorder-1.3.4/src/lib.rs rust-byteorder-1.4.3/src/lib.rs --- rust-byteorder-1.3.4/src/lib.rs 2020-02-07 13:17:07.000000000 +0000 +++ rust-byteorder-1.4.3/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -67,29 +67,15 @@ [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html */ -// For the 'try!' macro, until we bump MSRV past 1.12. -#![allow(deprecated)] - #![deny(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] -#[cfg(feature = "std")] -extern crate core; - -#[cfg(test)] -#[macro_use] -extern crate doc_comment; - -#[cfg(test)] -doctest!("../README.md"); - -use core::fmt::Debug; -use core::hash::Hash; -use core::ptr::copy_nonoverlapping; -use core::slice; +use core::{ + convert::TryInto, fmt::Debug, hash::Hash, ptr::copy_nonoverlapping, slice, +}; #[cfg(feature = "std")] -pub use io::{ReadBytesExt, WriteBytesExt}; +pub use crate::io::{ReadBytesExt, WriteBytesExt}; #[cfg(feature = "std")] mod io; @@ -100,7 +86,6 @@ (val << shift) as i64 >> shift } -#[cfg(byteorder_i128)] #[inline] fn extend_sign128(val: u128, nbytes: usize) -> i128 { let shift = (16 - nbytes) * 8; @@ -113,7 +98,6 @@ (val << shift) as u64 >> shift } -#[cfg(byteorder_i128)] #[inline] fn unextend_sign128(val: i128, nbytes: usize) -> u128 { let shift = (16 - nbytes) * 8; @@ -141,7 +125,6 @@ } } -#[cfg(byteorder_i128)] #[inline] fn pack_size128(n: u128) -> usize { if n < 1 << 8 { @@ -182,7 +165,7 @@ mod private { /// Sealed stops crates other than byteorder from implementing any traits /// that use it. - pub trait Sealed{} + pub trait Sealed {} impl Sealed for super::LittleEndian {} impl Sealed for super::BigEndian {} } @@ -222,8 +205,16 @@ /// /// [`BigEndian`]: enum.BigEndian.html /// [`LittleEndian`]: enum.LittleEndian.html -pub trait ByteOrder - : Clone + Copy + Debug + Default + Eq + Hash + Ord + PartialEq + PartialOrd +pub trait ByteOrder: + Clone + + Copy + + Debug + + Default + + Eq + + Hash + + Ord + + PartialEq + + PartialOrd + private::Sealed { /// Reads an unsigned 16 bit integer from `buf`. @@ -330,7 +321,6 @@ /// LittleEndian::write_u128(&mut buf, 1_000_000); /// assert_eq!(1_000_000, LittleEndian::read_u128(&buf)); /// ``` - #[cfg(byteorder_i128)] fn read_u128(buf: &[u8]) -> u128; /// Reads an unsigned n-bytes integer from `buf`. @@ -371,7 +361,6 @@ /// LittleEndian::write_uint128(&mut buf, 1_000_000, 3); /// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3)); /// ``` - #[cfg(byteorder_i128)] fn read_uint128(buf: &[u8], nbytes: usize) -> u128; /// Writes an unsigned 16 bit integer `n` to `buf`. @@ -490,7 +479,6 @@ /// LittleEndian::write_u128(&mut buf, 1_000_000); /// assert_eq!(1_000_000, LittleEndian::read_u128(&buf)); /// ``` - #[cfg(byteorder_i128)] fn write_u128(buf: &mut [u8], n: u128); /// Writes an unsigned integer `n` to `buf` using only `nbytes`. @@ -531,7 +519,6 @@ /// LittleEndian::write_uint128(&mut buf, 1_000_000, 3); /// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3)); /// ``` - #[cfg(byteorder_i128)] fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize); /// Reads a signed 16 bit integer from `buf`. @@ -661,7 +648,6 @@ /// LittleEndian::write_i128(&mut buf, -1_000_000_000); /// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf)); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_i128(buf: &[u8]) -> i128 { Self::read_u128(buf) as i128 @@ -708,7 +694,6 @@ /// LittleEndian::write_int128(&mut buf, -1_000, 3); /// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3)); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_int128(buf: &[u8], nbytes: usize) -> i128 { extend_sign128(Self::read_uint128(buf, nbytes), nbytes) @@ -734,7 +719,7 @@ /// ``` #[inline] fn read_f32(buf: &[u8]) -> f32 { - unsafe { *(&Self::read_u32(buf) as *const u32 as *const f32) } + f32::from_bits(Self::read_u32(buf)) } /// Reads a IEEE754 double-precision (8 bytes) floating point number. @@ -757,7 +742,7 @@ /// ``` #[inline] fn read_f64(buf: &[u8]) -> f64 { - unsafe { *(&Self::read_u64(buf) as *const u64 as *const f64) } + f64::from_bits(Self::read_u64(buf)) } /// Writes a signed 16 bit integer `n` to `buf`. @@ -887,7 +872,6 @@ /// LittleEndian::write_i128(&mut buf, -1_000_000_000); /// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf)); /// ``` - #[cfg(byteorder_i128)] #[inline] fn write_i128(buf: &mut [u8], n: i128) { Self::write_u128(buf, n as u128) @@ -934,7 +918,6 @@ /// LittleEndian::write_int128(&mut buf, -1_000, 3); /// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3)); /// ``` - #[cfg(byteorder_i128)] #[inline] fn write_int128(buf: &mut [u8], n: i128, nbytes: usize) { Self::write_uint128(buf, unextend_sign128(n, nbytes), nbytes) @@ -960,8 +943,7 @@ /// ``` #[inline] fn write_f32(buf: &mut [u8], n: f32) { - let n = unsafe { *(&n as *const f32 as *const u32) }; - Self::write_u32(buf, n) + Self::write_u32(buf, n.to_bits()) } /// Writes a IEEE754 double-precision (8 bytes) floating point number. @@ -984,8 +966,7 @@ /// ``` #[inline] fn write_f64(buf: &mut [u8], n: f64) { - let n = unsafe { *(&n as *const f64 as *const u64) }; - Self::write_u64(buf, n) + Self::write_u64(buf, n.to_bits()) } /// Reads unsigned 16 bit integers from `src` into `dst`. @@ -1078,7 +1059,6 @@ /// LittleEndian::read_u128_into(&bytes, &mut numbers_got); /// assert_eq!(numbers_given, numbers_got); /// ``` - #[cfg(byteorder_i128)] fn read_u128_into(src: &[u8], dst: &mut [u128]); /// Reads signed 16 bit integers from `src` to `dst`. @@ -1189,7 +1169,6 @@ /// LittleEndian::read_i128_into(&bytes, &mut numbers_got); /// assert_eq!(numbers_given, numbers_got); /// ``` - #[cfg(byteorder_i128)] #[inline] fn read_i128_into(src: &[u8], dst: &mut [i128]) { let dst = unsafe { @@ -1254,7 +1233,7 @@ /// assert_eq!(numbers_given, numbers_got); /// ``` #[inline] - #[deprecated(since="1.3.0", note="please use `read_f32_into` instead")] + #[deprecated(since = "1.3.0", note = "please use `read_f32_into` instead")] fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32]) { Self::read_f32_into(src, dst); } @@ -1316,7 +1295,7 @@ /// assert_eq!(numbers_given, numbers_got); /// ``` #[inline] - #[deprecated(since="1.3.0", note="please use `read_f64_into` instead")] + #[deprecated(since = "1.3.0", note = "please use `read_f64_into` instead")] fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64]) { Self::read_f64_into(src, dst); } @@ -1411,7 +1390,6 @@ /// LittleEndian::read_u128_into(&bytes, &mut numbers_got); /// assert_eq!(numbers_given, numbers_got); /// ``` - #[cfg(byteorder_i128)] fn write_u128_into(src: &[u128], dst: &mut [u8]); /// Writes signed 8 bit integers from `src` into `dst`. @@ -1553,7 +1531,6 @@ /// LittleEndian::read_i128_into(&bytes, &mut numbers_got); /// assert_eq!(numbers_given, numbers_got); /// ``` - #[cfg(byteorder_i128)] fn write_i128_into(src: &[i128], dst: &mut [u8]) { let src = unsafe { slice::from_raw_parts(src.as_ptr() as *const u128, src.len()) @@ -1580,9 +1557,7 @@ /// LittleEndian::write_f32_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0.0; 4]; - /// unsafe { - /// LittleEndian::read_f32_into(&bytes, &mut numbers_got); - /// } + /// LittleEndian::read_f32_into(&bytes, &mut numbers_got); /// assert_eq!(numbers_given, numbers_got); /// ``` fn write_f32_into(src: &[f32], dst: &mut [u8]) { @@ -1611,9 +1586,7 @@ /// LittleEndian::write_f64_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0.0; 4]; - /// unsafe { - /// LittleEndian::read_f64_into(&bytes, &mut numbers_got); - /// } + /// LittleEndian::read_f64_into(&bytes, &mut numbers_got); /// assert_eq!(numbers_given, numbers_got); /// ``` fn write_f64_into(src: &[f64], dst: &mut [u8]) { @@ -1697,7 +1670,6 @@ /// BigEndian::from_slice_u128(&mut numbers); /// assert_eq!(numbers, [5u128.to_be(), 65000u128.to_be()]); /// ``` - #[cfg(byteorder_i128)] fn from_slice_u128(numbers: &mut [u128]); /// Converts the given slice of signed 16 bit integers to a particular @@ -1720,7 +1692,7 @@ #[inline] fn from_slice_i16(src: &mut [i16]) { let src = unsafe { - slice::from_raw_parts_mut(src.as_ptr() as *mut u16, src.len()) + slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u16, src.len()) }; Self::from_slice_u16(src); } @@ -1745,7 +1717,7 @@ #[inline] fn from_slice_i32(src: &mut [i32]) { let src = unsafe { - slice::from_raw_parts_mut(src.as_ptr() as *mut u32, src.len()) + slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u32, src.len()) }; Self::from_slice_u32(src); } @@ -1770,7 +1742,7 @@ #[inline] fn from_slice_i64(src: &mut [i64]) { let src = unsafe { - slice::from_raw_parts_mut(src.as_ptr() as *mut u64, src.len()) + slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u64, src.len()) }; Self::from_slice_u64(src); } @@ -1792,11 +1764,10 @@ /// BigEndian::from_slice_i128(&mut numbers); /// assert_eq!(numbers, [5i128.to_be(), 65000i128.to_be()]); /// ``` - #[cfg(byteorder_i128)] #[inline] fn from_slice_i128(src: &mut [i128]) { let src = unsafe { - slice::from_raw_parts_mut(src.as_ptr() as *mut u128, src.len()) + slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u128, src.len()) }; Self::from_slice_u128(src); } @@ -1924,33 +1895,30 @@ #[cfg(target_endian = "big")] pub type NativeEndian = BigEndian; -macro_rules! read_num_bytes { - ($ty:ty, $size:expr, $src:expr, $which:ident) => ({ - assert!($size == ::core::mem::size_of::<$ty>()); - assert!($size <= $src.len()); - let mut data: $ty = 0; - unsafe { - copy_nonoverlapping( - $src.as_ptr(), - &mut data as *mut $ty as *mut u8, - $size); - } - data.$which() - }); -} - -macro_rules! write_num_bytes { - ($ty:ty, $size:expr, $n:expr, $dst:expr, $which:ident) => ({ +/// Copies $size bytes from a number $n to a &mut [u8] $dst. $ty represents the +/// numeric type of $n and $which must be either to_be or to_le, depending on +/// which endianness one wants to use when writing to $dst. +/// +/// This macro is only safe to call when $ty is a numeric type and $size == +/// size_of::<$ty>() and where $dst is a &mut [u8]. +macro_rules! unsafe_write_num_bytes { + ($ty:ty, $size:expr, $n:expr, $dst:expr, $which:ident) => {{ assert!($size <= $dst.len()); unsafe { // N.B. https://github.com/rust-lang/rust/issues/22776 let bytes = *(&$n.$which() as *const _ as *const [u8; $size]); copy_nonoverlapping((&bytes).as_ptr(), $dst.as_mut_ptr(), $size); } - }); + }}; } -macro_rules! read_slice { +/// Copies a &[u8] $src into a &mut [] $dst for the endianness given +/// by $which (must be either to_be or to_le). +/// +/// This macro is only safe to call when $src and $dst are &[u8] and &mut [u8], +/// respectively. The macro will panic if $src.len() != $size * $dst.len(), +/// where $size represents the size of the integers encoded in $src. +macro_rules! unsafe_read_slice { ($src:expr, $dst:expr, $size:expr, $which:ident) => {{ assert_eq!($src.len(), $size * $dst.len()); @@ -1958,7 +1926,8 @@ copy_nonoverlapping( $src.as_ptr(), $dst.as_mut_ptr() as *mut u8, - $src.len()); + $src.len(), + ); } for v in $dst.iter_mut() { *v = v.$which(); @@ -1966,51 +1935,57 @@ }}; } -macro_rules! write_slice_native { - ($src:expr, $dst:expr, $ty:ty, $size:expr) => {{ - assert!($size == ::core::mem::size_of::<$ty>()); - assert_eq!($size * $src.len(), $dst.len()); +/// Copies a &[$ty] $src into a &mut [u8] $dst, where $ty must be a numeric +/// type. This panics if size_of::<$ty>() * $src.len() != $dst.len(). +/// +/// This macro is only safe to call when $src is a slice of numeric types and +/// $dst is a &mut [u8] and where $ty represents the type of the integers in +/// $src. +macro_rules! unsafe_write_slice_native { + ($src:expr, $dst:expr, $ty:ty) => {{ + let size = core::mem::size_of::<$ty>(); + assert_eq!(size * $src.len(), $dst.len()); unsafe { copy_nonoverlapping( $src.as_ptr() as *const u8, $dst.as_mut_ptr(), - $dst.len()); + $dst.len(), + ); } }}; } macro_rules! write_slice { - ($src:expr, $dst:expr, $ty:ty, $size:expr, $write:expr) => ({ + ($src:expr, $dst:expr, $ty:ty, $size:expr, $write:expr) => {{ assert!($size == ::core::mem::size_of::<$ty>()); assert_eq!($size * $src.len(), $dst.len()); for (&n, chunk) in $src.iter().zip($dst.chunks_mut($size)) { $write(chunk, n); } - }); + }}; } impl ByteOrder for BigEndian { #[inline] fn read_u16(buf: &[u8]) -> u16 { - read_num_bytes!(u16, 2, buf, to_be) + u16::from_be_bytes(buf[..2].try_into().unwrap()) } #[inline] fn read_u32(buf: &[u8]) -> u32 { - read_num_bytes!(u32, 4, buf, to_be) + u32::from_be_bytes(buf[..4].try_into().unwrap()) } #[inline] fn read_u64(buf: &[u8]) -> u64 { - read_num_bytes!(u64, 8, buf, to_be) + u64::from_be_bytes(buf[..8].try_into().unwrap()) } - #[cfg(byteorder_i128)] #[inline] fn read_u128(buf: &[u8]) -> u128 { - read_num_bytes!(u128, 16, buf, to_be) + u128::from_be_bytes(buf[..16].try_into().unwrap()) } #[inline] @@ -2020,12 +1995,14 @@ let ptr_out = &mut out as *mut u64 as *mut u8; unsafe { copy_nonoverlapping( - buf.as_ptr(), ptr_out.offset((8 - nbytes) as isize), nbytes); + buf.as_ptr(), + ptr_out.offset((8 - nbytes) as isize), + nbytes, + ); } out.to_be() } - #[cfg(byteorder_i128)] #[inline] fn read_uint128(buf: &[u8], nbytes: usize) -> u128 { assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len()); @@ -2033,30 +2010,32 @@ let ptr_out = &mut out as *mut u128 as *mut u8; unsafe { copy_nonoverlapping( - buf.as_ptr(), ptr_out.offset((16 - nbytes) as isize), nbytes); + buf.as_ptr(), + ptr_out.offset((16 - nbytes) as isize), + nbytes, + ); } out.to_be() } #[inline] fn write_u16(buf: &mut [u8], n: u16) { - write_num_bytes!(u16, 2, n, buf, to_be); + unsafe_write_num_bytes!(u16, 2, n, buf, to_be); } #[inline] fn write_u32(buf: &mut [u8], n: u32) { - write_num_bytes!(u32, 4, n, buf, to_be); + unsafe_write_num_bytes!(u32, 4, n, buf, to_be); } #[inline] fn write_u64(buf: &mut [u8], n: u64) { - write_num_bytes!(u64, 8, n, buf, to_be); + unsafe_write_num_bytes!(u64, 8, n, buf, to_be); } - #[cfg(byteorder_i128)] #[inline] fn write_u128(buf: &mut [u8], n: u128) { - write_num_bytes!(u128, 16, n, buf, to_be); + unsafe_write_num_bytes!(u128, 16, n, buf, to_be); } #[inline] @@ -2068,11 +2047,11 @@ copy_nonoverlapping( bytes.as_ptr().offset((8 - nbytes) as isize), buf.as_mut_ptr(), - nbytes); + nbytes, + ); } } - #[cfg(byteorder_i128)] #[inline] fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) { assert!(pack_size128(n) <= nbytes && nbytes <= 16); @@ -2082,35 +2061,35 @@ copy_nonoverlapping( bytes.as_ptr().offset((16 - nbytes) as isize), buf.as_mut_ptr(), - nbytes); + nbytes, + ); } } #[inline] fn read_u16_into(src: &[u8], dst: &mut [u16]) { - read_slice!(src, dst, 2, to_be); + unsafe_read_slice!(src, dst, 2, to_be); } #[inline] fn read_u32_into(src: &[u8], dst: &mut [u32]) { - read_slice!(src, dst, 4, to_be); + unsafe_read_slice!(src, dst, 4, to_be); } #[inline] fn read_u64_into(src: &[u8], dst: &mut [u64]) { - read_slice!(src, dst, 8, to_be); + unsafe_read_slice!(src, dst, 8, to_be); } - #[cfg(byteorder_i128)] #[inline] fn read_u128_into(src: &[u8], dst: &mut [u128]) { - read_slice!(src, dst, 16, to_be); + unsafe_read_slice!(src, dst, 16, to_be); } #[inline] fn write_u16_into(src: &[u16], dst: &mut [u8]) { if cfg!(target_endian = "big") { - write_slice_native!(src, dst, u16, 2); + unsafe_write_slice_native!(src, dst, u16); } else { write_slice!(src, dst, u16, 2, Self::write_u16); } @@ -2119,7 +2098,7 @@ #[inline] fn write_u32_into(src: &[u32], dst: &mut [u8]) { if cfg!(target_endian = "big") { - write_slice_native!(src, dst, u32, 4); + unsafe_write_slice_native!(src, dst, u32); } else { write_slice!(src, dst, u32, 4, Self::write_u32); } @@ -2128,17 +2107,16 @@ #[inline] fn write_u64_into(src: &[u64], dst: &mut [u8]) { if cfg!(target_endian = "big") { - write_slice_native!(src, dst, u64, 8); + unsafe_write_slice_native!(src, dst, u64); } else { write_slice!(src, dst, u64, 8, Self::write_u64); } } - #[cfg(byteorder_i128)] #[inline] fn write_u128_into(src: &[u128], dst: &mut [u8]) { if cfg!(target_endian = "big") { - write_slice_native!(src, dst, u128, 16); + unsafe_write_slice_native!(src, dst, u128); } else { write_slice!(src, dst, u128, 16, Self::write_u128); } @@ -2171,7 +2149,6 @@ } } - #[cfg(byteorder_i128)] #[inline] fn from_slice_u128(numbers: &mut [u128]) { if cfg!(target_endian = "little") { @@ -2209,23 +2186,22 @@ impl ByteOrder for LittleEndian { #[inline] fn read_u16(buf: &[u8]) -> u16 { - read_num_bytes!(u16, 2, buf, to_le) + u16::from_le_bytes(buf[..2].try_into().unwrap()) } #[inline] fn read_u32(buf: &[u8]) -> u32 { - read_num_bytes!(u32, 4, buf, to_le) + u32::from_le_bytes(buf[..4].try_into().unwrap()) } #[inline] fn read_u64(buf: &[u8]) -> u64 { - read_num_bytes!(u64, 8, buf, to_le) + u64::from_le_bytes(buf[..8].try_into().unwrap()) } - #[cfg(byteorder_i128)] #[inline] fn read_u128(buf: &[u8]) -> u128 { - read_num_bytes!(u128, 16, buf, to_le) + u128::from_le_bytes(buf[..16].try_into().unwrap()) } #[inline] @@ -2239,7 +2215,6 @@ out.to_le() } - #[cfg(byteorder_i128)] #[inline] fn read_uint128(buf: &[u8], nbytes: usize) -> u128 { assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len()); @@ -2253,23 +2228,22 @@ #[inline] fn write_u16(buf: &mut [u8], n: u16) { - write_num_bytes!(u16, 2, n, buf, to_le); + unsafe_write_num_bytes!(u16, 2, n, buf, to_le); } #[inline] fn write_u32(buf: &mut [u8], n: u32) { - write_num_bytes!(u32, 4, n, buf, to_le); + unsafe_write_num_bytes!(u32, 4, n, buf, to_le); } #[inline] fn write_u64(buf: &mut [u8], n: u64) { - write_num_bytes!(u64, 8, n, buf, to_le); + unsafe_write_num_bytes!(u64, 8, n, buf, to_le); } - #[cfg(byteorder_i128)] #[inline] fn write_u128(buf: &mut [u8], n: u128) { - write_num_bytes!(u128, 16, n, buf, to_le); + unsafe_write_num_bytes!(u128, 16, n, buf, to_le); } #[inline] @@ -2282,7 +2256,6 @@ } } - #[cfg(byteorder_i128)] #[inline] fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) { assert!(pack_size128(n as u128) <= nbytes && nbytes <= 16); @@ -2295,29 +2268,28 @@ #[inline] fn read_u16_into(src: &[u8], dst: &mut [u16]) { - read_slice!(src, dst, 2, to_le); + unsafe_read_slice!(src, dst, 2, to_le); } #[inline] fn read_u32_into(src: &[u8], dst: &mut [u32]) { - read_slice!(src, dst, 4, to_le); + unsafe_read_slice!(src, dst, 4, to_le); } #[inline] fn read_u64_into(src: &[u8], dst: &mut [u64]) { - read_slice!(src, dst, 8, to_le); + unsafe_read_slice!(src, dst, 8, to_le); } - #[cfg(byteorder_i128)] #[inline] fn read_u128_into(src: &[u8], dst: &mut [u128]) { - read_slice!(src, dst, 16, to_le); + unsafe_read_slice!(src, dst, 16, to_le); } #[inline] fn write_u16_into(src: &[u16], dst: &mut [u8]) { if cfg!(target_endian = "little") { - write_slice_native!(src, dst, u16, 2); + unsafe_write_slice_native!(src, dst, u16); } else { write_slice!(src, dst, u16, 2, Self::write_u16); } @@ -2326,7 +2298,7 @@ #[inline] fn write_u32_into(src: &[u32], dst: &mut [u8]) { if cfg!(target_endian = "little") { - write_slice_native!(src, dst, u32, 4); + unsafe_write_slice_native!(src, dst, u32); } else { write_slice!(src, dst, u32, 4, Self::write_u32); } @@ -2335,17 +2307,16 @@ #[inline] fn write_u64_into(src: &[u64], dst: &mut [u8]) { if cfg!(target_endian = "little") { - write_slice_native!(src, dst, u64, 8); + unsafe_write_slice_native!(src, dst, u64); } else { write_slice!(src, dst, u64, 8, Self::write_u64); } } - #[cfg(byteorder_i128)] #[inline] fn write_u128_into(src: &[u128], dst: &mut [u8]) { if cfg!(target_endian = "little") { - write_slice_native!(src, dst, u128, 16); + unsafe_write_slice_native!(src, dst, u128); } else { write_slice!(src, dst, u128, 16, Self::write_u128); } @@ -2378,7 +2349,6 @@ } } - #[cfg(byteorder_i128)] #[inline] fn from_slice_u128(numbers: &mut [u128]) { if cfg!(target_endian = "big") { @@ -2415,15 +2385,8 @@ #[cfg(test)] mod test { - extern crate quickcheck; - extern crate rand; - - use self::quickcheck::{QuickCheck, StdGen, Testable}; - use self::rand::thread_rng; - #[cfg(byteorder_i128)] - use self::rand::Rng; - #[cfg(byteorder_i128)] - use self::quickcheck::{Arbitrary, Gen}; + use quickcheck::{Arbitrary, Gen, QuickCheck, StdGen, Testable}; + use rand::{thread_rng, Rng}; pub const U24_MAX: u32 = 16_777_215; pub const I24_MAX: i32 = 8_388_607; @@ -2434,7 +2397,9 @@ pub const I64_MAX: u64 = ::core::i64::MAX as u64; macro_rules! calc_max { - ($max:expr, $bytes:expr) => { calc_max!($max, $bytes, 8) }; + ($max:expr, $bytes:expr) => { + calc_max!($max, $bytes, 8) + }; ($max:expr, $bytes:expr, $maxbytes:expr) => { ($max - 1) >> (8 * ($maxbytes - $bytes)) }; @@ -2443,7 +2408,6 @@ #[derive(Clone, Debug)] pub struct Wi128(pub T); - #[cfg(byteorder_i128)] impl Wi128 { pub fn clone(&self) -> T { self.0.clone() @@ -2456,24 +2420,20 @@ } } - #[cfg(byteorder_i128)] impl Arbitrary for Wi128 { fn arbitrary(gen: &mut G) -> Wi128 { let max = calc_max!(::core::u128::MAX, gen.size(), 16); - let output = - (gen.gen::() as u128) | - ((gen.gen::() as u128) << 64); + let output = (gen.gen::() as u128) + | ((gen.gen::() as u128) << 64); Wi128(output & (max - 1)) } } - #[cfg(byteorder_i128)] impl Arbitrary for Wi128 { fn arbitrary(gen: &mut G) -> Wi128 { let max = calc_max!(::core::i128::MAX, gen.size(), 16); - let output = - (gen.gen::() as i128) | - ((gen.gen::() as i128) << 64); + let output = (gen.gen::() as i128) + | ((gen.gen::() as i128) << 64); Wi128(output & (max - 1)) } } @@ -2488,10 +2448,13 @@ macro_rules! qc_byte_order { ($name:ident, $ty_int:ty, $max:expr, - $bytes:expr, $read:ident, $write:ident) => ( + $bytes:expr, $read:ident, $write:ident) => { mod $name { - use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; - #[allow(unused_imports)] use super::{ qc_sized, Wi128 }; + #[allow(unused_imports)] + use super::{qc_sized, Wi128}; + use crate::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; #[test] fn big_endian() { @@ -2523,13 +2486,16 @@ qc_sized(prop as fn($ty_int) -> bool, $max); } } - ); + }; ($name:ident, $ty_int:ty, $max:expr, - $read:ident, $write:ident) => ( + $read:ident, $write:ident) => { mod $name { + #[allow(unused_imports)] + use super::{qc_sized, Wi128}; + use crate::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; use core::mem::size_of; - use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; - #[allow(unused_imports)] use super::{ qc_sized, Wi128 }; #[test] fn big_endian() { @@ -2564,159 +2530,484 @@ qc_sized(prop as fn($ty_int) -> bool, $max - 1); } } - ); + }; } - qc_byte_order!(prop_u16, u16, ::core::u16::MAX as u64, read_u16, write_u16); - qc_byte_order!(prop_i16, i16, ::core::i16::MAX as u64, read_i16, write_i16); - qc_byte_order!(prop_u24, u32, ::test::U24_MAX as u64, read_u24, write_u24); - qc_byte_order!(prop_i24, i32, ::test::I24_MAX as u64, read_i24, write_i24); - qc_byte_order!(prop_u32, u32, ::core::u32::MAX as u64, read_u32, write_u32); - qc_byte_order!(prop_i32, i32, ::core::i32::MAX as u64, read_i32, write_i32); - qc_byte_order!(prop_u48, u64, ::test::U48_MAX as u64, read_u48, write_u48); - qc_byte_order!(prop_i48, i64, ::test::I48_MAX as u64, read_i48, write_i48); - qc_byte_order!(prop_u64, u64, ::core::u64::MAX as u64, read_u64, write_u64); - qc_byte_order!(prop_i64, i64, ::core::i64::MAX as u64, read_i64, write_i64); - qc_byte_order!(prop_f32, f32, ::core::u64::MAX as u64, read_f32, write_f32); - qc_byte_order!(prop_f64, f64, ::core::i64::MAX as u64, read_f64, write_f64); + qc_byte_order!( + prop_u16, + u16, + ::core::u16::MAX as u64, + read_u16, + write_u16 + ); + qc_byte_order!( + prop_i16, + i16, + ::core::i16::MAX as u64, + read_i16, + write_i16 + ); + qc_byte_order!( + prop_u24, + u32, + crate::test::U24_MAX as u64, + read_u24, + write_u24 + ); + qc_byte_order!( + prop_i24, + i32, + crate::test::I24_MAX as u64, + read_i24, + write_i24 + ); + qc_byte_order!( + prop_u32, + u32, + ::core::u32::MAX as u64, + read_u32, + write_u32 + ); + qc_byte_order!( + prop_i32, + i32, + ::core::i32::MAX as u64, + read_i32, + write_i32 + ); + qc_byte_order!( + prop_u48, + u64, + crate::test::U48_MAX as u64, + read_u48, + write_u48 + ); + qc_byte_order!( + prop_i48, + i64, + crate::test::I48_MAX as u64, + read_i48, + write_i48 + ); + qc_byte_order!( + prop_u64, + u64, + ::core::u64::MAX as u64, + read_u64, + write_u64 + ); + qc_byte_order!( + prop_i64, + i64, + ::core::i64::MAX as u64, + read_i64, + write_i64 + ); + qc_byte_order!( + prop_f32, + f32, + ::core::u64::MAX as u64, + read_f32, + write_f32 + ); + qc_byte_order!( + prop_f64, + f64, + ::core::i64::MAX as u64, + read_f64, + write_f64 + ); - #[cfg(byteorder_i128)] qc_byte_order!(prop_u128, Wi128, 16 + 1, read_u128, write_u128); - #[cfg(byteorder_i128)] qc_byte_order!(prop_i128, Wi128, 16 + 1, read_i128, write_i128); - qc_byte_order!(prop_uint_1, - u64, calc_max!(super::U64_MAX, 1), 1, read_uint, write_uint); - qc_byte_order!(prop_uint_2, - u64, calc_max!(super::U64_MAX, 2), 2, read_uint, write_uint); - qc_byte_order!(prop_uint_3, - u64, calc_max!(super::U64_MAX, 3), 3, read_uint, write_uint); - qc_byte_order!(prop_uint_4, - u64, calc_max!(super::U64_MAX, 4), 4, read_uint, write_uint); - qc_byte_order!(prop_uint_5, - u64, calc_max!(super::U64_MAX, 5), 5, read_uint, write_uint); - qc_byte_order!(prop_uint_6, - u64, calc_max!(super::U64_MAX, 6), 6, read_uint, write_uint); - qc_byte_order!(prop_uint_7, - u64, calc_max!(super::U64_MAX, 7), 7, read_uint, write_uint); - qc_byte_order!(prop_uint_8, - u64, calc_max!(super::U64_MAX, 8), 8, read_uint, write_uint); - - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_1, - Wi128, 1, 1, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_2, - Wi128, 2, 2, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_3, - Wi128, 3, 3, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_4, - Wi128, 4, 4, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_5, - Wi128, 5, 5, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_6, - Wi128, 6, 6, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_7, - Wi128, 7, 7, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_8, - Wi128, 8, 8, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_9, - Wi128, 9, 9, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_10, - Wi128, 10, 10, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_11, - Wi128, 11, 11, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_12, - Wi128, 12, 12, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_13, - Wi128, 13, 13, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_14, - Wi128, 14, 14, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_15, - Wi128, 15, 15, read_uint128, write_uint128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_uint128_16, - Wi128, 16, 16, read_uint128, write_uint128); - - qc_byte_order!(prop_int_1, - i64, calc_max!(super::I64_MAX, 1), 1, read_int, write_int); - qc_byte_order!(prop_int_2, - i64, calc_max!(super::I64_MAX, 2), 2, read_int, write_int); - qc_byte_order!(prop_int_3, - i64, calc_max!(super::I64_MAX, 3), 3, read_int, write_int); - qc_byte_order!(prop_int_4, - i64, calc_max!(super::I64_MAX, 4), 4, read_int, write_int); - qc_byte_order!(prop_int_5, - i64, calc_max!(super::I64_MAX, 5), 5, read_int, write_int); - qc_byte_order!(prop_int_6, - i64, calc_max!(super::I64_MAX, 6), 6, read_int, write_int); - qc_byte_order!(prop_int_7, - i64, calc_max!(super::I64_MAX, 7), 7, read_int, write_int); - qc_byte_order!(prop_int_8, - i64, calc_max!(super::I64_MAX, 8), 8, read_int, write_int); - - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_1, - Wi128, 1, 1, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_2, - Wi128, 2, 2, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_3, - Wi128, 3, 3, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_4, - Wi128, 4, 4, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_5, - Wi128, 5, 5, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_6, - Wi128, 6, 6, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_7, - Wi128, 7, 7, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_8, - Wi128, 8, 8, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_9, - Wi128, 9, 9, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_10, - Wi128, 10, 10, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_11, - Wi128, 11, 11, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_12, - Wi128, 12, 12, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_13, - Wi128, 13, 13, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_14, - Wi128, 14, 14, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_15, - Wi128, 15, 15, read_int128, write_int128); - #[cfg(byteorder_i128)] - qc_byte_order!(prop_int128_16, - Wi128, 16, 16, read_int128, write_int128); - + qc_byte_order!( + prop_uint_1, + u64, + calc_max!(super::U64_MAX, 1), + 1, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_2, + u64, + calc_max!(super::U64_MAX, 2), + 2, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_3, + u64, + calc_max!(super::U64_MAX, 3), + 3, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_4, + u64, + calc_max!(super::U64_MAX, 4), + 4, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_5, + u64, + calc_max!(super::U64_MAX, 5), + 5, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_6, + u64, + calc_max!(super::U64_MAX, 6), + 6, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_7, + u64, + calc_max!(super::U64_MAX, 7), + 7, + read_uint, + write_uint + ); + qc_byte_order!( + prop_uint_8, + u64, + calc_max!(super::U64_MAX, 8), + 8, + read_uint, + write_uint + ); + + qc_byte_order!( + prop_uint128_1, + Wi128, + 1, + 1, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_2, + Wi128, + 2, + 2, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_3, + Wi128, + 3, + 3, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_4, + Wi128, + 4, + 4, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_5, + Wi128, + 5, + 5, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_6, + Wi128, + 6, + 6, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_7, + Wi128, + 7, + 7, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_8, + Wi128, + 8, + 8, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_9, + Wi128, + 9, + 9, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_10, + Wi128, + 10, + 10, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_11, + Wi128, + 11, + 11, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_12, + Wi128, + 12, + 12, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_13, + Wi128, + 13, + 13, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_14, + Wi128, + 14, + 14, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_15, + Wi128, + 15, + 15, + read_uint128, + write_uint128 + ); + qc_byte_order!( + prop_uint128_16, + Wi128, + 16, + 16, + read_uint128, + write_uint128 + ); + + qc_byte_order!( + prop_int_1, + i64, + calc_max!(super::I64_MAX, 1), + 1, + read_int, + write_int + ); + qc_byte_order!( + prop_int_2, + i64, + calc_max!(super::I64_MAX, 2), + 2, + read_int, + write_int + ); + qc_byte_order!( + prop_int_3, + i64, + calc_max!(super::I64_MAX, 3), + 3, + read_int, + write_int + ); + qc_byte_order!( + prop_int_4, + i64, + calc_max!(super::I64_MAX, 4), + 4, + read_int, + write_int + ); + qc_byte_order!( + prop_int_5, + i64, + calc_max!(super::I64_MAX, 5), + 5, + read_int, + write_int + ); + qc_byte_order!( + prop_int_6, + i64, + calc_max!(super::I64_MAX, 6), + 6, + read_int, + write_int + ); + qc_byte_order!( + prop_int_7, + i64, + calc_max!(super::I64_MAX, 7), + 7, + read_int, + write_int + ); + qc_byte_order!( + prop_int_8, + i64, + calc_max!(super::I64_MAX, 8), + 8, + read_int, + write_int + ); + + qc_byte_order!( + prop_int128_1, + Wi128, + 1, + 1, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_2, + Wi128, + 2, + 2, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_3, + Wi128, + 3, + 3, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_4, + Wi128, + 4, + 4, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_5, + Wi128, + 5, + 5, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_6, + Wi128, + 6, + 6, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_7, + Wi128, + 7, + 7, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_8, + Wi128, + 8, + 8, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_9, + Wi128, + 9, + 9, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_10, + Wi128, + 10, + 10, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_11, + Wi128, + 11, + 11, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_12, + Wi128, + 12, + 12, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_13, + Wi128, + 13, + 13, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_14, + Wi128, + 14, + 14, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_15, + Wi128, + 15, + 15, + read_int128, + write_int128 + ); + qc_byte_order!( + prop_int128_16, + Wi128, + 16, + 16, + read_int128, + write_int128 + ); // Test that all of the byte conversion functions panic when given a // buffer that is too small. @@ -2725,9 +3016,11 @@ // with a buffer overflow. macro_rules! too_small { ($name:ident, $maximally_small:expr, $zero:expr, - $read:ident, $write:ident) => ( + $read:ident, $write:ident) => { mod $name { - use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + use crate::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; #[test] #[should_panic] @@ -2771,10 +3064,12 @@ NativeEndian::$write(&mut buf, $zero); } } - ); - ($name:ident, $maximally_small:expr, $read:ident) => ( + }; + ($name:ident, $maximally_small:expr, $read:ident) => { mod $name { - use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + use crate::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; #[test] #[should_panic] @@ -2797,7 +3092,7 @@ NativeEndian::$read(&buf, $maximally_small + 1); } } - ); + }; } too_small!(small_u16, 1, 0, read_u16, write_u16); @@ -2808,9 +3103,7 @@ too_small!(small_i64, 7, 0, read_i64, write_i64); too_small!(small_f32, 3, 0.0, read_f32, write_f32); too_small!(small_f64, 7, 0.0, read_f64, write_f64); - #[cfg(byteorder_i128)] too_small!(small_u128, 15, 0, read_u128, write_u128); - #[cfg(byteorder_i128)] too_small!(small_i128, 15, 0, read_i128, write_i128); too_small!(small_uint_1, 1, read_uint); @@ -2821,35 +3114,20 @@ too_small!(small_uint_6, 6, read_uint); too_small!(small_uint_7, 7, read_uint); - #[cfg(byteorder_i128)] too_small!(small_uint128_1, 1, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_2, 2, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_3, 3, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_4, 4, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_5, 5, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_6, 6, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_7, 7, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_8, 8, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_9, 9, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_10, 10, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_11, 11, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_12, 12, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_13, 13, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_14, 14, read_uint128); - #[cfg(byteorder_i128)] too_small!(small_uint128_15, 15, read_uint128); too_small!(small_int_1, 1, read_int); @@ -2860,35 +3138,20 @@ too_small!(small_int_6, 6, read_int); too_small!(small_int_7, 7, read_int); - #[cfg(byteorder_i128)] too_small!(small_int128_1, 1, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_2, 2, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_3, 3, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_4, 4, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_5, 5, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_6, 6, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_7, 7, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_8, 8, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_9, 9, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_10, 10, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_11, 11, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_12, 12, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_13, 13, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_14, 14, read_int128); - #[cfg(byteorder_i128)] too_small!(small_int128_15, 15, read_int128); // Test that reading/writing slices enforces the correct lengths. @@ -2896,7 +3159,9 @@ ($name:ident, $read:ident, $write:ident, $num_bytes:expr, $numbers:expr) => { mod $name { - use {ByteOrder, BigEndian, NativeEndian, LittleEndian}; + use crate::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; #[test] #[should_panic] @@ -2946,55 +3211,172 @@ NativeEndian::$write(&numbers, &mut bytes); } } - } + }; } slice_lengths!( - slice_len_too_small_u16, read_u16_into, write_u16_into, 3, [0, 0]); + slice_len_too_small_u16, + read_u16_into, + write_u16_into, + 3, + [0, 0] + ); slice_lengths!( - slice_len_too_big_u16, read_u16_into, write_u16_into, 5, [0, 0]); + slice_len_too_big_u16, + read_u16_into, + write_u16_into, + 5, + [0, 0] + ); slice_lengths!( - slice_len_too_small_i16, read_i16_into, write_i16_into, 3, [0, 0]); + slice_len_too_small_i16, + read_i16_into, + write_i16_into, + 3, + [0, 0] + ); slice_lengths!( - slice_len_too_big_i16, read_i16_into, write_i16_into, 5, [0, 0]); + slice_len_too_big_i16, + read_i16_into, + write_i16_into, + 5, + [0, 0] + ); slice_lengths!( - slice_len_too_small_u32, read_u32_into, write_u32_into, 7, [0, 0]); + slice_len_too_small_u32, + read_u32_into, + write_u32_into, + 7, + [0, 0] + ); slice_lengths!( - slice_len_too_big_u32, read_u32_into, write_u32_into, 9, [0, 0]); + slice_len_too_big_u32, + read_u32_into, + write_u32_into, + 9, + [0, 0] + ); slice_lengths!( - slice_len_too_small_i32, read_i32_into, write_i32_into, 7, [0, 0]); + slice_len_too_small_i32, + read_i32_into, + write_i32_into, + 7, + [0, 0] + ); slice_lengths!( - slice_len_too_big_i32, read_i32_into, write_i32_into, 9, [0, 0]); + slice_len_too_big_i32, + read_i32_into, + write_i32_into, + 9, + [0, 0] + ); slice_lengths!( - slice_len_too_small_u64, read_u64_into, write_u64_into, 15, [0, 0]); + slice_len_too_small_u64, + read_u64_into, + write_u64_into, + 15, + [0, 0] + ); slice_lengths!( - slice_len_too_big_u64, read_u64_into, write_u64_into, 17, [0, 0]); + slice_len_too_big_u64, + read_u64_into, + write_u64_into, + 17, + [0, 0] + ); slice_lengths!( - slice_len_too_small_i64, read_i64_into, write_i64_into, 15, [0, 0]); + slice_len_too_small_i64, + read_i64_into, + write_i64_into, + 15, + [0, 0] + ); slice_lengths!( - slice_len_too_big_i64, read_i64_into, write_i64_into, 17, [0, 0]); + slice_len_too_big_i64, + read_i64_into, + write_i64_into, + 17, + [0, 0] + ); - #[cfg(byteorder_i128)] slice_lengths!( - slice_len_too_small_u128, read_u128_into, write_u128_into, 31, [0, 0]); - #[cfg(byteorder_i128)] + slice_len_too_small_u128, + read_u128_into, + write_u128_into, + 31, + [0, 0] + ); slice_lengths!( - slice_len_too_big_u128, read_u128_into, write_u128_into, 33, [0, 0]); - #[cfg(byteorder_i128)] + slice_len_too_big_u128, + read_u128_into, + write_u128_into, + 33, + [0, 0] + ); slice_lengths!( - slice_len_too_small_i128, read_i128_into, write_i128_into, 31, [0, 0]); - #[cfg(byteorder_i128)] + slice_len_too_small_i128, + read_i128_into, + write_i128_into, + 31, + [0, 0] + ); slice_lengths!( - slice_len_too_big_i128, read_i128_into, write_i128_into, 33, [0, 0]); + slice_len_too_big_i128, + read_i128_into, + write_i128_into, + 33, + [0, 0] + ); #[test] fn uint_bigger_buffer() { - use {ByteOrder, LittleEndian}; + use crate::{ByteOrder, LittleEndian}; let n = LittleEndian::read_uint(&[1, 2, 3, 4, 5, 6, 7, 8], 5); assert_eq!(n, 0x05_0403_0201); } + + #[test] + fn regression173_array_impl() { + use crate::{BigEndian, ByteOrder, LittleEndian}; + + let xs = [0; 100]; + + let x = BigEndian::read_u16(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_u32(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_u64(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_u128(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_i16(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_i32(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_i64(&xs); + assert_eq!(x, 0); + let x = BigEndian::read_i128(&xs); + assert_eq!(x, 0); + + let x = LittleEndian::read_u16(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_u32(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_u64(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_u128(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_i16(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_i32(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_i64(&xs); + assert_eq!(x, 0); + let x = LittleEndian::read_i128(&xs); + assert_eq!(x, 0); + } } #[cfg(test)] @@ -3007,7 +3389,6 @@ use self::rand::thread_rng; fn qc_unsized(f: A) { - QuickCheck::new() .gen(StdGen::new(thread_rng(), 16)) .tests(1_00) @@ -3016,19 +3397,22 @@ } macro_rules! calc_max { - ($max:expr, $bytes:expr) => { ($max - 1) >> (8 * (8 - $bytes)) }; + ($max:expr, $bytes:expr) => { + ($max - 1) >> (8 * (8 - $bytes)) + }; } macro_rules! qc_bytes_ext { ($name:ident, $ty_int:ty, $max:expr, - $bytes:expr, $read:ident, $write:ident) => ( + $bytes:expr, $read:ident, $write:ident) => { mod $name { - use std::io::Cursor; - use { - ReadBytesExt, WriteBytesExt, - BigEndian, NativeEndian, LittleEndian, + #[allow(unused_imports)] + use crate::test::{qc_sized, Wi128}; + use crate::{ + BigEndian, LittleEndian, NativeEndian, ReadBytesExt, + WriteBytesExt, }; - #[allow(unused_imports)] use test::{qc_sized, Wi128}; + use std::io::Cursor; #[test] fn big_endian() { @@ -3069,15 +3453,16 @@ qc_sized(prop as fn($ty_int) -> bool, $max); } } - ); - ($name:ident, $ty_int:ty, $max:expr, $read:ident, $write:ident) => ( + }; + ($name:ident, $ty_int:ty, $max:expr, $read:ident, $write:ident) => { mod $name { - use std::io::Cursor; - use { - ReadBytesExt, WriteBytesExt, - BigEndian, NativeEndian, LittleEndian, + #[allow(unused_imports)] + use crate::test::{qc_sized, Wi128}; + use crate::{ + BigEndian, LittleEndian, NativeEndian, ReadBytesExt, + WriteBytesExt, }; - #[allow(unused_imports)] use test::{qc_sized, Wi128}; + use std::io::Cursor; #[test] fn big_endian() { @@ -3112,188 +3497,484 @@ qc_sized(prop as fn($ty_int) -> bool, $max - 1); } } - ); + }; } - qc_bytes_ext!(prop_ext_u16, - u16, ::std::u16::MAX as u64, read_u16, write_u16); - qc_bytes_ext!(prop_ext_i16, - i16, ::std::i16::MAX as u64, read_i16, write_i16); - qc_bytes_ext!(prop_ext_u32, - u32, ::std::u32::MAX as u64, read_u32, write_u32); - qc_bytes_ext!(prop_ext_i32, - i32, ::std::i32::MAX as u64, read_i32, write_i32); - qc_bytes_ext!(prop_ext_u64, - u64, ::std::u64::MAX as u64, read_u64, write_u64); - qc_bytes_ext!(prop_ext_i64, - i64, ::std::i64::MAX as u64, read_i64, write_i64); - qc_bytes_ext!(prop_ext_f32, - f32, ::std::u64::MAX as u64, read_f32, write_f32); - qc_bytes_ext!(prop_ext_f64, - f64, ::std::i64::MAX as u64, read_f64, write_f64); + qc_bytes_ext!( + prop_ext_u16, + u16, + ::std::u16::MAX as u64, + read_u16, + write_u16 + ); + qc_bytes_ext!( + prop_ext_i16, + i16, + ::std::i16::MAX as u64, + read_i16, + write_i16 + ); + qc_bytes_ext!( + prop_ext_u32, + u32, + ::std::u32::MAX as u64, + read_u32, + write_u32 + ); + qc_bytes_ext!( + prop_ext_i32, + i32, + ::std::i32::MAX as u64, + read_i32, + write_i32 + ); + qc_bytes_ext!( + prop_ext_u64, + u64, + ::std::u64::MAX as u64, + read_u64, + write_u64 + ); + qc_bytes_ext!( + prop_ext_i64, + i64, + ::std::i64::MAX as u64, + read_i64, + write_i64 + ); + qc_bytes_ext!( + prop_ext_f32, + f32, + ::std::u64::MAX as u64, + read_f32, + write_f32 + ); + qc_bytes_ext!( + prop_ext_f64, + f64, + ::std::i64::MAX as u64, + read_f64, + write_f64 + ); - #[cfg(byteorder_i128)] qc_bytes_ext!(prop_ext_u128, Wi128, 16 + 1, read_u128, write_u128); - #[cfg(byteorder_i128)] qc_bytes_ext!(prop_ext_i128, Wi128, 16 + 1, read_i128, write_i128); - qc_bytes_ext!(prop_ext_uint_1, - u64, calc_max!(::test::U64_MAX, 1), 1, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_2, - u64, calc_max!(::test::U64_MAX, 2), 2, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_3, - u64, calc_max!(::test::U64_MAX, 3), 3, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_4, - u64, calc_max!(::test::U64_MAX, 4), 4, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_5, - u64, calc_max!(::test::U64_MAX, 5), 5, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_6, - u64, calc_max!(::test::U64_MAX, 6), 6, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_7, - u64, calc_max!(::test::U64_MAX, 7), 7, read_uint, write_u64); - qc_bytes_ext!(prop_ext_uint_8, - u64, calc_max!(::test::U64_MAX, 8), 8, read_uint, write_u64); - - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_1, - Wi128, 1, 1, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_2, - Wi128, 2, 2, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_3, - Wi128, 3, 3, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_4, - Wi128, 4, 4, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_5, - Wi128, 5, 5, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_6, - Wi128, 6, 6, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_7, - Wi128, 7, 7, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_8, - Wi128, 8, 8, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_9, - Wi128, 9, 9, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_10, - Wi128, 10, 10, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_11, - Wi128, 11, 11, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_12, - Wi128, 12, 12, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_13, - Wi128, 13, 13, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_14, - Wi128, 14, 14, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_15, - Wi128, 15, 15, read_uint128, write_u128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_uint128_16, - Wi128, 16, 16, read_uint128, write_u128); - - qc_bytes_ext!(prop_ext_int_1, - i64, calc_max!(::test::I64_MAX, 1), 1, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_2, - i64, calc_max!(::test::I64_MAX, 2), 2, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_3, - i64, calc_max!(::test::I64_MAX, 3), 3, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_4, - i64, calc_max!(::test::I64_MAX, 4), 4, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_5, - i64, calc_max!(::test::I64_MAX, 5), 5, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_6, - i64, calc_max!(::test::I64_MAX, 6), 6, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_7, - i64, calc_max!(::test::I64_MAX, 1), 7, read_int, write_i64); - qc_bytes_ext!(prop_ext_int_8, - i64, calc_max!(::test::I64_MAX, 8), 8, read_int, write_i64); - - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_1, - Wi128, 1, 1, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_2, - Wi128, 2, 2, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_3, - Wi128, 3, 3, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_4, - Wi128, 4, 4, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_5, - Wi128, 5, 5, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_6, - Wi128, 6, 6, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_7, - Wi128, 7, 7, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_8, - Wi128, 8, 8, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_9, - Wi128, 9, 9, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_10, - Wi128, 10, 10, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_11, - Wi128, 11, 11, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_12, - Wi128, 12, 12, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_13, - Wi128, 13, 13, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_14, - Wi128, 14, 14, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_15, - Wi128, 15, 15, read_int128, write_i128); - #[cfg(byteorder_i128)] - qc_bytes_ext!(prop_ext_int128_16, - Wi128, 16, 16, read_int128, write_i128); + qc_bytes_ext!( + prop_ext_uint_1, + u64, + calc_max!(crate::test::U64_MAX, 1), + 1, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_2, + u64, + calc_max!(crate::test::U64_MAX, 2), + 2, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_3, + u64, + calc_max!(crate::test::U64_MAX, 3), + 3, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_4, + u64, + calc_max!(crate::test::U64_MAX, 4), + 4, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_5, + u64, + calc_max!(crate::test::U64_MAX, 5), + 5, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_6, + u64, + calc_max!(crate::test::U64_MAX, 6), + 6, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_7, + u64, + calc_max!(crate::test::U64_MAX, 7), + 7, + read_uint, + write_u64 + ); + qc_bytes_ext!( + prop_ext_uint_8, + u64, + calc_max!(crate::test::U64_MAX, 8), + 8, + read_uint, + write_u64 + ); + + qc_bytes_ext!( + prop_ext_uint128_1, + Wi128, + 1, + 1, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_2, + Wi128, + 2, + 2, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_3, + Wi128, + 3, + 3, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_4, + Wi128, + 4, + 4, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_5, + Wi128, + 5, + 5, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_6, + Wi128, + 6, + 6, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_7, + Wi128, + 7, + 7, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_8, + Wi128, + 8, + 8, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_9, + Wi128, + 9, + 9, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_10, + Wi128, + 10, + 10, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_11, + Wi128, + 11, + 11, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_12, + Wi128, + 12, + 12, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_13, + Wi128, + 13, + 13, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_14, + Wi128, + 14, + 14, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_15, + Wi128, + 15, + 15, + read_uint128, + write_u128 + ); + qc_bytes_ext!( + prop_ext_uint128_16, + Wi128, + 16, + 16, + read_uint128, + write_u128 + ); + + qc_bytes_ext!( + prop_ext_int_1, + i64, + calc_max!(crate::test::I64_MAX, 1), + 1, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_2, + i64, + calc_max!(crate::test::I64_MAX, 2), + 2, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_3, + i64, + calc_max!(crate::test::I64_MAX, 3), + 3, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_4, + i64, + calc_max!(crate::test::I64_MAX, 4), + 4, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_5, + i64, + calc_max!(crate::test::I64_MAX, 5), + 5, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_6, + i64, + calc_max!(crate::test::I64_MAX, 6), + 6, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_7, + i64, + calc_max!(crate::test::I64_MAX, 1), + 7, + read_int, + write_i64 + ); + qc_bytes_ext!( + prop_ext_int_8, + i64, + calc_max!(crate::test::I64_MAX, 8), + 8, + read_int, + write_i64 + ); + + qc_bytes_ext!( + prop_ext_int128_1, + Wi128, + 1, + 1, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_2, + Wi128, + 2, + 2, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_3, + Wi128, + 3, + 3, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_4, + Wi128, + 4, + 4, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_5, + Wi128, + 5, + 5, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_6, + Wi128, + 6, + 6, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_7, + Wi128, + 7, + 7, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_8, + Wi128, + 8, + 8, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_9, + Wi128, + 9, + 9, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_10, + Wi128, + 10, + 10, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_11, + Wi128, + 11, + 11, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_12, + Wi128, + 12, + 12, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_13, + Wi128, + 13, + 13, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_14, + Wi128, + 14, + 14, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_15, + Wi128, + 15, + 15, + read_int128, + write_i128 + ); + qc_bytes_ext!( + prop_ext_int128_16, + Wi128, + 16, + 16, + read_int128, + write_i128 + ); // Test slice serialization/deserialization. macro_rules! qc_slice { ($name:ident, $ty_int:ty, $read:ident, $write:ident, $zero:expr) => { mod $name { - use core::mem::size_of; - use {ByteOrder, BigEndian, NativeEndian, LittleEndian}; use super::qc_unsized; #[allow(unused_imports)] - use test::Wi128; + use crate::test::Wi128; + use crate::{ + BigEndian, ByteOrder, LittleEndian, NativeEndian, + }; + use core::mem::size_of; #[test] fn big_endian() { #[allow(unused_unsafe)] fn prop(numbers: Vec<$ty_int>) -> bool { - let numbers: Vec<_> = numbers - .into_iter() - .map(|x| x.clone()) - .collect(); + let numbers: Vec<_> = + numbers.into_iter().map(|x| x.clone()).collect(); let num_bytes = size_of::<$ty_int>() * numbers.len(); let mut bytes = vec![0; num_bytes]; BigEndian::$write(&numbers, &mut bytes); let mut got = vec![$zero; numbers.len()]; - unsafe { BigEndian::$read(&bytes, &mut got); } + unsafe { + BigEndian::$read(&bytes, &mut got); + } numbers == got } @@ -3304,17 +3985,17 @@ fn little_endian() { #[allow(unused_unsafe)] fn prop(numbers: Vec<$ty_int>) -> bool { - let numbers: Vec<_> = numbers - .into_iter() - .map(|x| x.clone()) - .collect(); + let numbers: Vec<_> = + numbers.into_iter().map(|x| x.clone()).collect(); let num_bytes = size_of::<$ty_int>() * numbers.len(); let mut bytes = vec![0; num_bytes]; LittleEndian::$write(&numbers, &mut bytes); let mut got = vec![$zero; numbers.len()]; - unsafe { LittleEndian::$read(&bytes, &mut got); } + unsafe { + LittleEndian::$read(&bytes, &mut got); + } numbers == got } @@ -3325,24 +4006,24 @@ fn native_endian() { #[allow(unused_unsafe)] fn prop(numbers: Vec<$ty_int>) -> bool { - let numbers: Vec<_> = numbers - .into_iter() - .map(|x| x.clone()) - .collect(); + let numbers: Vec<_> = + numbers.into_iter().map(|x| x.clone()).collect(); let num_bytes = size_of::<$ty_int>() * numbers.len(); let mut bytes = vec![0; num_bytes]; NativeEndian::$write(&numbers, &mut bytes); let mut got = vec![$zero; numbers.len()]; - unsafe { NativeEndian::$read(&bytes, &mut got); } + unsafe { + NativeEndian::$read(&bytes, &mut got); + } numbers == got } qc_unsized(prop as fn(_) -> bool); } } - } + }; } qc_slice!(prop_slice_u16, u16, read_u16_into, write_u16_into, 0); @@ -3351,15 +4032,21 @@ qc_slice!(prop_slice_i32, i32, read_i32_into, write_i32_into, 0); qc_slice!(prop_slice_u64, u64, read_u64_into, write_u64_into, 0); qc_slice!(prop_slice_i64, i64, read_i64_into, write_i64_into, 0); - #[cfg(byteorder_i128)] qc_slice!( - prop_slice_u128, Wi128, read_u128_into, write_u128_into, 0); - #[cfg(byteorder_i128)] + prop_slice_u128, + Wi128, + read_u128_into, + write_u128_into, + 0 + ); qc_slice!( - prop_slice_i128, Wi128, read_i128_into, write_i128_into, 0); + prop_slice_i128, + Wi128, + read_i128_into, + write_i128_into, + 0 + ); - qc_slice!( - prop_slice_f32, f32, read_f32_into, write_f32_into, 0.0); - qc_slice!( - prop_slice_f64, f64, read_f64_into, write_f64_into, 0.0); + qc_slice!(prop_slice_f32, f32, read_f32_into, write_f32_into, 0.0); + qc_slice!(prop_slice_f64, f64, read_f64_into, write_f64_into, 0.0); } diff -Nru rust-byteorder-1.3.4/.travis.yml rust-byteorder-1.4.3/.travis.yml --- rust-byteorder-1.3.4/.travis.yml 2018-02-22 12:18:13.000000000 +0000 +++ rust-byteorder-1.4.3/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -language: rust -matrix: - include: - - rust: 1.12.0 - - rust: stable - - rust: beta - - rust: nightly - - env: CROSS_TARGET=mips64-unknown-linux-gnuabi64 - rust: stable - services: docker - sudo: required -script: ci/script.sh -branches: - only: - - master