Snap for 7474514 from c9e0a669bf9267447aa6fc6533ab9f798e8255ae to mainline-media-swcodec-release

Change-Id: I9656e4b2ae798843e54dbdfea64b7b57c3fa9c57
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index e7e8b81..cd7856e 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "058237661a88c2f610f280340310fce19d98d265"
+    "sha1": "abffade8232229db557e0a30c395963071624b2b"
   }
 }
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..2c2c790
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -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 --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 082c5cc..0000000
--- a/.travis.yml
+++ /dev/null
@@ -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
diff --git a/Android.bp b/Android.bp
index 72ef217..3efba93 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,17 +1,51 @@
-// This file is generated by cargo2android.py.
+// This file is generated by cargo2android.py --run --device --dependencies.
+// Do not modify this file as changes will be overridden on upgrade.
 
-rust_library_rlib {
+package {
+    default_applicable_licenses: ["external_rust_crates_byteorder_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// See: http://go/android-license-faq
+license {
+    name: "external_rust_crates_byteorder_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-MIT",
+        "SPDX-license-identifier-Unlicense",
+    ],
+    license_text: [
+        "COPYING",
+        "LICENSE-MIT",
+        "UNLICENSE",
+    ],
+}
+
+rust_library {
     name: "libbyteorder",
-    deny_warnings: false,
     host_supported: true,
     crate_name: "byteorder",
     srcs: ["src/lib.rs"],
-    edition: "2015",
+    edition: "2018",
     features: [
         "default",
         "std",
     ],
-    flags: [
-        "--cfg byteorder_i128",
-    ],
 }
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 020beb4..6b51eb0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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 --git a/Cargo.toml b/Cargo.toml
index fb2acad..c71f90b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,17 +11,17 @@
 # will likely look very different (and much more reasonable)
 
 [package]
+edition = "2018"
 name = "byteorder"
-version = "1.3.2"
+version = "1.4.3"
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
-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 --git a/Cargo.toml.orig b/Cargo.toml.orig
index 91f2aa3..728f668 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,26 +1,25 @@
 [package]
 name = "byteorder"
-version = "1.3.2"  #:version
+version = "1.4.3"  #:version
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
 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 --git a/LICENSE b/LICENSE
new file mode 120000
index 0000000..7f9a88e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+LICENSE-MIT
\ No newline at end of file
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..c5a4b7d
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,19 @@
+name: "byteorder"
+description: "Library for reading/writing numbers in big-endian and little-endian."
+third_party {
+  url {
+    type: HOMEPAGE
+    value: "https://crates.io/crates/byteorder"
+  }
+  url {
+    type: ARCHIVE
+    value: "https://static.crates.io/crates/byteorder/byteorder-1.4.3.crate"
+  }
+  version: "1.4.3"
+  license_type: NOTICE
+  last_upgrade_date {
+    year: 2021
+    month: 4
+    day: 1
+  }
+}
diff --git a/MODULE_LICENSE_MIT b/MODULE_LICENSE_MIT
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_MIT
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..46fc303
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+include platform/prebuilts/rust:/OWNERS
diff --git a/README.md b/README.md
index 8940b29..d8461c5 100644
--- a/README.md
+++ b/README.md
@@ -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 --git a/benches/bench.rs b/benches/bench.rs
index d53d25e..bb00422 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -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]);
+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]
+);
 
-#[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]);
+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]
+);
 
-#[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!(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 --git a/build.rs b/build.rs
deleted file mode 100644
index 002135b..0000000
--- a/build.rs
+++ /dev/null
@@ -1,87 +0,0 @@
-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<Version, String> {
-        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<Version, String> {
-        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::<u32>().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::<u32>().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::<u32>().map_err(|e| e.to_string()));
-
-        Ok(Version { major: major, minor: minor, patch: patch })
-    }
-}
diff --git a/rustfmt.toml b/rustfmt.toml
new file mode 100644
index 0000000..aa37a21
--- /dev/null
+++ b/rustfmt.toml
@@ -0,0 +1,2 @@
+max_width = 79
+use_small_heuristics = "max"
diff --git a/src/io.rs b/src/io.rs
index ed6a848..dfad2ca 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -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<u8> {
         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<i8> {
         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<T: ByteOrder>(&mut self) -> Result<u16> {
         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<T: ByteOrder>(&mut self) -> Result<i16> {
         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<T: ByteOrder>(&mut self) -> Result<u32> {
         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<T: ByteOrder>(&mut self) -> Result<i32> {
         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<T: ByteOrder>(&mut self) -> Result<u32> {
         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<T: ByteOrder>(&mut self) -> Result<i32> {
         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<T: ByteOrder>(&mut self) -> Result<u64> {
         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<T: ByteOrder>(&mut self) -> Result<i64> {
         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<T: ByteOrder>(&mut self) -> Result<u64> {
         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<T: ByteOrder>(&mut self) -> Result<i64> {
         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::<BigEndian>().unwrap());
     /// ```
-    #[cfg(byteorder_i128)]
     #[inline]
     fn read_u128<T: ByteOrder>(&mut self) -> Result<u128> {
         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::<BigEndian>().unwrap());
     /// ```
-    #[cfg(byteorder_i128)]
     #[inline]
     fn read_i128<T: ByteOrder>(&mut self) -> Result<i128> {
         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<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u64> {
         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<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i64> {
         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<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u128> {
         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<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i128> {
         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<T: ByteOrder>(&mut self) -> Result<f32> {
         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<T: ByteOrder>(&mut self) -> Result<f64> {
         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<T: ByteOrder>(&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<T: ByteOrder>(&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<T: ByteOrder>(&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::<BigEndian>(&mut dst).unwrap();
     /// assert_eq!([517, 768], dst);
     /// ```
-    #[cfg(byteorder_i128)]
     #[inline]
     fn read_u128_into<T: ByteOrder>(
         &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<T: ByteOrder>(&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<T: ByteOrder>(&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<T: ByteOrder>(&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::<BigEndian>(&mut dst).unwrap();
     /// assert_eq!([517, 768], dst);
     /// ```
-    #[cfg(byteorder_i128)]
     #[inline]
     fn read_i128_into<T: ByteOrder>(
         &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<T: ByteOrder>(
-        &mut self,
-        dst: &mut [f32],
-    ) -> Result<()> {
+    fn read_f32_into<T: ByteOrder>(&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<T: ByteOrder>(
         &mut self,
         dst: &mut [f32],
@@ -991,13 +984,10 @@
     /// assert_eq!([f64::consts::PI, 1.0], dst);
     /// ```
     #[inline]
-    fn read_f64_into<T: ByteOrder>(
-        &mut self,
-        dst: &mut [f64],
-    ) -> Result<()> {
+    fn read_f64_into<T: ByteOrder>(&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<T: ByteOrder>(
         &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<T: ByteOrder>(&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<T: ByteOrder>(&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<T: ByteOrder>(
         &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<T: ByteOrder>(
         &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<T: Copy>(slice: &mut [T]) -> &mut [u8] {
     use std::mem::size_of;
 
diff --git a/src/lib.rs b/src/lib.rs
index db4d24d..cc37cca 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -70,23 +70,12 @@
 #![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;
@@ -97,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;
@@ -110,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;
@@ -138,7 +125,6 @@
     }
 }
 
-#[cfg(byteorder_i128)]
 #[inline]
 fn pack_size128(n: u128) -> usize {
     if n < 1 << 8 {
@@ -179,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 {}
 }
@@ -219,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`.
@@ -327,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`.
@@ -368,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`.
@@ -487,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`.
@@ -528,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`.
@@ -658,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
@@ -705,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)
@@ -731,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.
@@ -754,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`.
@@ -884,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)
@@ -931,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)
@@ -957,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.
@@ -981,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`.
@@ -1075,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`.
@@ -1186,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 {
@@ -1251,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);
     }
@@ -1313,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);
     }
@@ -1408,9 +1390,42 @@
     /// 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`.
+    ///
+    /// Note that since each `i8` is a single byte, no byte order conversions
+    /// are used. This method is included because it provides a safe, simple
+    /// way for the caller to write from a `&[i8]` buffer. (Without this
+    /// method, the caller would have to either use `unsafe` code or convert
+    /// each byte to `u8` individually.)
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() != src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i8` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian, ReadBytesExt};
+    ///
+    /// let mut bytes = [0; 4];
+    /// let numbers_given = [1, 2, 0xf, 0xe];
+    /// LittleEndian::write_i8_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// bytes.as_ref().read_i8_into(&mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_i8_into(src: &[i8], dst: &mut [u8]) {
+        let src = unsafe {
+            slice::from_raw_parts(src.as_ptr() as *const u8, src.len())
+        };
+        dst.copy_from_slice(src);
+    }
+
     /// Writes signed 16 bit integers from `src` into `dst`.
     ///
     /// # Panics
@@ -1516,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())
@@ -1543,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]) {
@@ -1574,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]) {
@@ -1660,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
@@ -1683,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);
     }
@@ -1708,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);
     }
@@ -1733,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);
     }
@@ -1755,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);
     }
@@ -1887,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 [<numeric>] $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());
 
@@ -1921,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();
@@ -1929,97 +1935,107 @@
     }};
 }
 
-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]
     fn read_uint(buf: &[u8], nbytes: usize) -> u64 {
         assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len());
-        let mut out = [0u8; 8];
-        let ptr_out = out.as_mut_ptr();
+        let mut out = 0u64;
+        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);
-            (*(ptr_out as *const u64)).to_be()
+                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());
-        let mut out = [0u8; 16];
-        let ptr_out = out.as_mut_ptr();
+        let mut out: u128 = 0;
+        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);
-            (*(ptr_out as *const u128)).to_be()
+                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]
@@ -2031,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);
@@ -2045,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);
         }
@@ -2082,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);
         }
@@ -2091,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);
         }
@@ -2134,7 +2149,6 @@
         }
     }
 
-    #[cfg(byteorder_i128)]
     #[inline]
     fn from_slice_u128(numbers: &mut [u128]) {
         if cfg!(target_endian = "little") {
@@ -2172,67 +2186,64 @@
 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]
     fn read_uint(buf: &[u8], nbytes: usize) -> u64 {
         assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len());
-        let mut out = [0u8; 8];
-        let ptr_out = out.as_mut_ptr();
+        let mut out = 0u64;
+        let ptr_out = &mut out as *mut u64 as *mut u8;
         unsafe {
             copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes);
-            (*(ptr_out as *const u64)).to_le()
         }
+        out.to_le()
     }
 
-    #[cfg(byteorder_i128)]
     #[inline]
     fn read_uint128(buf: &[u8], nbytes: usize) -> u128 {
         assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len());
-        let mut out = [0u8; 16];
-        let ptr_out = out.as_mut_ptr();
+        let mut out: u128 = 0;
+        let ptr_out = &mut out as *mut u128 as *mut u8;
         unsafe {
             copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes);
-            (*(ptr_out as *const u128)).to_le()
         }
+        out.to_le()
     }
 
     #[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]
@@ -2245,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);
@@ -2258,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);
         }
@@ -2289,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);
         }
@@ -2298,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);
         }
@@ -2341,7 +2349,6 @@
         }
     }
 
-    #[cfg(byteorder_i128)]
     #[inline]
     fn from_slice_u128(numbers: &mut [u128]) {
         if cfg!(target_endian = "big") {
@@ -2378,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;
@@ -2397,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))
         };
@@ -2406,7 +2408,6 @@
     #[derive(Clone, Debug)]
     pub struct Wi128<T>(pub T);
 
-    #[cfg(byteorder_i128)]
     impl<T: Clone> Wi128<T> {
         pub fn clone(&self) -> T {
             self.0.clone()
@@ -2419,24 +2420,20 @@
         }
     }
 
-    #[cfg(byteorder_i128)]
     impl Arbitrary for Wi128<u128> {
         fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<u128> {
             let max = calc_max!(::core::u128::MAX, gen.size(), 16);
-            let output =
-                (gen.gen::<u64>() as u128) |
-                ((gen.gen::<u64>() as u128) << 64);
+            let output = (gen.gen::<u64>() as u128)
+                | ((gen.gen::<u64>() as u128) << 64);
             Wi128(output & (max - 1))
         }
     }
 
-    #[cfg(byteorder_i128)]
     impl Arbitrary for Wi128<i128> {
         fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<i128> {
             let max = calc_max!(::core::i128::MAX, gen.size(), 16);
-            let output =
-                (gen.gen::<i64>() as i128) |
-                ((gen.gen::<i64>() as i128) << 64);
+            let output = (gen.gen::<i64>() as i128)
+                | ((gen.gen::<i64>() as i128) << 64);
             Wi128(output & (max - 1))
         }
     }
@@ -2451,17 +2448,20 @@
 
     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() {
                     fn prop(n: $ty_int) -> bool {
                         let mut buf = [0; 16];
                         BigEndian::$write(&mut buf, n.clone(), $bytes);
-                        n == BigEndian::$read(&mut buf[..$bytes], $bytes)
+                        n == BigEndian::$read(&buf[..$bytes], $bytes)
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
@@ -2471,7 +2471,7 @@
                     fn prop(n: $ty_int) -> bool {
                         let mut buf = [0; 16];
                         LittleEndian::$write(&mut buf, n.clone(), $bytes);
-                        n == LittleEndian::$read(&mut buf[..$bytes], $bytes)
+                        n == LittleEndian::$read(&buf[..$bytes], $bytes)
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
@@ -2481,18 +2481,21 @@
                     fn prop(n: $ty_int) -> bool {
                         let mut buf = [0; 16];
                         NativeEndian::$write(&mut buf, n.clone(), $bytes);
-                        n == NativeEndian::$read(&mut buf[..$bytes], $bytes)
+                        n == NativeEndian::$read(&buf[..$bytes], $bytes)
                     }
                     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() {
@@ -2500,7 +2503,7 @@
                         let bytes = size_of::<$ty_int>();
                         let mut buf = [0; 16];
                         BigEndian::$write(&mut buf[16 - bytes..], n.clone());
-                        n == BigEndian::$read(&mut buf[16 - bytes..])
+                        n == BigEndian::$read(&buf[16 - bytes..])
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
@@ -2511,7 +2514,7 @@
                         let bytes = size_of::<$ty_int>();
                         let mut buf = [0; 16];
                         LittleEndian::$write(&mut buf[..bytes], n.clone());
-                        n == LittleEndian::$read(&mut buf[..bytes])
+                        n == LittleEndian::$read(&buf[..bytes])
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
@@ -2522,164 +2525,489 @@
                         let bytes = size_of::<$ty_int>();
                         let mut buf = [0; 16];
                         NativeEndian::$write(&mut buf[..bytes], n.clone());
-                        n == NativeEndian::$read(&mut buf[..bytes])
+                        n == NativeEndian::$read(&buf[..bytes])
                     }
                     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<u128>, 16 + 1, read_u128, write_u128);
-    #[cfg(byteorder_i128)]
     qc_byte_order!(prop_i128, Wi128<i128>, 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);
+    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<u128>, 1, 1, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_2,
-        Wi128<u128>, 2, 2, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_3,
-        Wi128<u128>, 3, 3, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_4,
-        Wi128<u128>, 4, 4, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_5,
-        Wi128<u128>, 5, 5, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_6,
-        Wi128<u128>, 6, 6, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_7,
-        Wi128<u128>, 7, 7, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_8,
-        Wi128<u128>, 8, 8, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_9,
-        Wi128<u128>, 9, 9, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_10,
-        Wi128<u128>, 10, 10, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_11,
-        Wi128<u128>, 11, 11, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_12,
-        Wi128<u128>, 12, 12, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_13,
-        Wi128<u128>, 13, 13, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_14,
-        Wi128<u128>, 14, 14, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_15,
-        Wi128<u128>, 15, 15, read_uint128, write_uint128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_uint128_16,
-        Wi128<u128>, 16, 16, read_uint128, write_uint128);
+    qc_byte_order!(
+        prop_uint128_1,
+        Wi128<u128>,
+        1,
+        1,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_2,
+        Wi128<u128>,
+        2,
+        2,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_3,
+        Wi128<u128>,
+        3,
+        3,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_4,
+        Wi128<u128>,
+        4,
+        4,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_5,
+        Wi128<u128>,
+        5,
+        5,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_6,
+        Wi128<u128>,
+        6,
+        6,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_7,
+        Wi128<u128>,
+        7,
+        7,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_8,
+        Wi128<u128>,
+        8,
+        8,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_9,
+        Wi128<u128>,
+        9,
+        9,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_10,
+        Wi128<u128>,
+        10,
+        10,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_11,
+        Wi128<u128>,
+        11,
+        11,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_12,
+        Wi128<u128>,
+        12,
+        12,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_13,
+        Wi128<u128>,
+        13,
+        13,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_14,
+        Wi128<u128>,
+        14,
+        14,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_15,
+        Wi128<u128>,
+        15,
+        15,
+        read_uint128,
+        write_uint128
+    );
+    qc_byte_order!(
+        prop_uint128_16,
+        Wi128<u128>,
+        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_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<i128>, 1, 1, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_2,
-        Wi128<i128>, 2, 2, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_3,
-        Wi128<i128>, 3, 3, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_4,
-        Wi128<i128>, 4, 4, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_5,
-        Wi128<i128>, 5, 5, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_6,
-        Wi128<i128>, 6, 6, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_7,
-        Wi128<i128>, 7, 7, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_8,
-        Wi128<i128>, 8, 8, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_9,
-        Wi128<i128>, 9, 9, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_10,
-        Wi128<i128>, 10, 10, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_11,
-        Wi128<i128>, 11, 11, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_12,
-        Wi128<i128>, 12, 12, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_13,
-        Wi128<i128>, 13, 13, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_14,
-        Wi128<i128>, 14, 14, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_15,
-        Wi128<i128>, 15, 15, read_int128, write_int128);
-    #[cfg(byteorder_i128)]
-    qc_byte_order!(prop_int128_16,
-        Wi128<i128>, 16, 16, read_int128, write_int128);
-
+    qc_byte_order!(
+        prop_int128_1,
+        Wi128<i128>,
+        1,
+        1,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_2,
+        Wi128<i128>,
+        2,
+        2,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_3,
+        Wi128<i128>,
+        3,
+        3,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_4,
+        Wi128<i128>,
+        4,
+        4,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_5,
+        Wi128<i128>,
+        5,
+        5,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_6,
+        Wi128<i128>,
+        6,
+        6,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_7,
+        Wi128<i128>,
+        7,
+        7,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_8,
+        Wi128<i128>,
+        8,
+        8,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_9,
+        Wi128<i128>,
+        9,
+        9,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_10,
+        Wi128<i128>,
+        10,
+        10,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_11,
+        Wi128<i128>,
+        11,
+        11,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_12,
+        Wi128<i128>,
+        12,
+        12,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_13,
+        Wi128<i128>,
+        13,
+        13,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_14,
+        Wi128<i128>,
+        14,
+        14,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_15,
+        Wi128<i128>,
+        15,
+        15,
+        read_int128,
+        write_int128
+    );
+    qc_byte_order!(
+        prop_int128_16,
+        Wi128<i128>,
+        16,
+        16,
+        read_int128,
+        write_int128
+    );
 
     // Test that all of the byte conversion functions panic when given a
     // buffer that is too small.
@@ -2688,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]
@@ -2734,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]
@@ -2760,7 +3092,7 @@
                     NativeEndian::$read(&buf, $maximally_small + 1);
                 }
             }
-        );
+        };
     }
 
     too_small!(small_u16, 1, 0, read_u16, write_u16);
@@ -2771,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);
@@ -2784,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);
@@ -2823,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.
@@ -2859,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]
@@ -2909,54 +3211,171 @@
                     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, 0x0504030201);
+        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);
     }
 }
 
@@ -2970,7 +3389,6 @@
     use self::rand::thread_rng;
 
     fn qc_unsized<A: Testable>(f: A) {
-
         QuickCheck::new()
             .gen(StdGen::new(thread_rng(), 16))
             .tests(1_00)
@@ -2979,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() {
@@ -3032,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() {
@@ -3075,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<u128>, 16 + 1, read_u128, write_u128);
-    #[cfg(byteorder_i128)]
     qc_bytes_ext!(prop_ext_i128, Wi128<i128>, 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);
+    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
+    );
 
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_1,
-        Wi128<u128>, 1, 1, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_2,
-        Wi128<u128>, 2, 2, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_3,
-        Wi128<u128>, 3, 3, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_4,
-        Wi128<u128>, 4, 4, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_5,
-        Wi128<u128>, 5, 5, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_6,
-        Wi128<u128>, 6, 6, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_7,
-        Wi128<u128>, 7, 7, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_8,
-        Wi128<u128>, 8, 8, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_9,
-        Wi128<u128>, 9, 9, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_10,
-        Wi128<u128>, 10, 10, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_11,
-        Wi128<u128>, 11, 11, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_12,
-        Wi128<u128>, 12, 12, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_13,
-        Wi128<u128>, 13, 13, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_14,
-        Wi128<u128>, 14, 14, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_15,
-        Wi128<u128>, 15, 15, read_uint128, write_u128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_uint128_16,
-        Wi128<u128>, 16, 16, read_uint128, write_u128);
+    qc_bytes_ext!(
+        prop_ext_uint128_1,
+        Wi128<u128>,
+        1,
+        1,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_2,
+        Wi128<u128>,
+        2,
+        2,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_3,
+        Wi128<u128>,
+        3,
+        3,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_4,
+        Wi128<u128>,
+        4,
+        4,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_5,
+        Wi128<u128>,
+        5,
+        5,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_6,
+        Wi128<u128>,
+        6,
+        6,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_7,
+        Wi128<u128>,
+        7,
+        7,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_8,
+        Wi128<u128>,
+        8,
+        8,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_9,
+        Wi128<u128>,
+        9,
+        9,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_10,
+        Wi128<u128>,
+        10,
+        10,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_11,
+        Wi128<u128>,
+        11,
+        11,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_12,
+        Wi128<u128>,
+        12,
+        12,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_13,
+        Wi128<u128>,
+        13,
+        13,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_14,
+        Wi128<u128>,
+        14,
+        14,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_15,
+        Wi128<u128>,
+        15,
+        15,
+        read_uint128,
+        write_u128
+    );
+    qc_bytes_ext!(
+        prop_ext_uint128_16,
+        Wi128<u128>,
+        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);
+    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
+    );
 
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_1,
-        Wi128<i128>, 1, 1, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_2,
-        Wi128<i128>, 2, 2, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_3,
-        Wi128<i128>, 3, 3, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_4,
-        Wi128<i128>, 4, 4, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_5,
-        Wi128<i128>, 5, 5, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_6,
-        Wi128<i128>, 6, 6, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_7,
-        Wi128<i128>, 7, 7, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_8,
-        Wi128<i128>, 8, 8, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_9,
-        Wi128<i128>, 9, 9, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_10,
-        Wi128<i128>, 10, 10, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_11,
-        Wi128<i128>, 11, 11, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_12,
-        Wi128<i128>, 12, 12, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_13,
-        Wi128<i128>, 13, 13, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_14,
-        Wi128<i128>, 14, 14, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_15,
-        Wi128<i128>, 15, 15, read_int128, write_i128);
-    #[cfg(byteorder_i128)]
-    qc_bytes_ext!(prop_ext_int128_16,
-        Wi128<i128>, 16, 16, read_int128, write_i128);
+    qc_bytes_ext!(
+        prop_ext_int128_1,
+        Wi128<i128>,
+        1,
+        1,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_2,
+        Wi128<i128>,
+        2,
+        2,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_3,
+        Wi128<i128>,
+        3,
+        3,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_4,
+        Wi128<i128>,
+        4,
+        4,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_5,
+        Wi128<i128>,
+        5,
+        5,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_6,
+        Wi128<i128>,
+        6,
+        6,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_7,
+        Wi128<i128>,
+        7,
+        7,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_8,
+        Wi128<i128>,
+        8,
+        8,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_9,
+        Wi128<i128>,
+        9,
+        9,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_10,
+        Wi128<i128>,
+        10,
+        10,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_11,
+        Wi128<i128>,
+        11,
+        11,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_12,
+        Wi128<i128>,
+        12,
+        12,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_13,
+        Wi128<i128>,
+        13,
+        13,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_14,
+        Wi128<i128>,
+        14,
+        14,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_15,
+        Wi128<i128>,
+        15,
+        15,
+        read_int128,
+        write_i128
+    );
+    qc_bytes_ext!(
+        prop_ext_int128_16,
+        Wi128<i128>,
+        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
                     }
@@ -3267,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
                     }
@@ -3288,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);
@@ -3314,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<u128>, read_u128_into, write_u128_into, 0);
-    #[cfg(byteorder_i128)]
+        prop_slice_u128,
+        Wi128<u128>,
+        read_u128_into,
+        write_u128_into,
+        0
+    );
     qc_slice!(
-        prop_slice_i128, Wi128<i128>, read_i128_into, write_i128_into, 0);
+        prop_slice_i128,
+        Wi128<i128>,
+        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);
 }