From 1b56de8cd1dfc47729bddbafb023819086296e2e Mon Sep 17 00:00:00 2001 From: Leonhard Markert Date: Mon, 10 Feb 2020 09:01:43 +0100 Subject: [PATCH] Remove macro_use As of Rust 2018, macro_use is no longer required in most circumstances. I think it is generally a good idea to remove these when not needed, to stop them from polluting the crate's global namespace. https://doc.rust-lang.org/edition-guide/rust-2018/macros/macro-changes.html#macro_rules-style-macros --- nix-rust/src/lib.rs | 11 ----------- nix-rust/src/store/path.rs | 1 + nix-rust/src/util/base32.rs | 3 +++ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/nix-rust/src/lib.rs b/nix-rust/src/lib.rs index e62613ba8..27ea69fbd 100644 --- a/nix-rust/src/lib.rs +++ b/nix-rust/src/lib.rs @@ -1,14 +1,3 @@ -#[macro_use] -extern crate lazy_static; - -#[cfg(test)] -#[macro_use] -extern crate assert_matches; - -#[cfg(test)] -#[macro_use] -extern crate proptest; - #[cfg(not(test))] mod c; mod error; diff --git a/nix-rust/src/store/path.rs b/nix-rust/src/store/path.rs index 2a5170bef..47b5975c0 100644 --- a/nix-rust/src/store/path.rs +++ b/nix-rust/src/store/path.rs @@ -138,6 +138,7 @@ impl fmt::Display for StorePathName { #[cfg(test)] mod tests { use super::*; + use assert_matches::assert_matches; #[test] fn test_parse() { diff --git a/nix-rust/src/util/base32.rs b/nix-rust/src/util/base32.rs index ba7368933..efd4a2901 100644 --- a/nix-rust/src/util/base32.rs +++ b/nix-rust/src/util/base32.rs @@ -1,4 +1,5 @@ use crate::error::Error; +use lazy_static::lazy_static; pub fn encoded_len(input_len: usize) -> usize { if input_len == 0 { @@ -87,7 +88,9 @@ pub fn decode(input: &str) -> Result, crate::Error> { #[cfg(test)] mod tests { use super::*; + use assert_matches::assert_matches; use hex; + use proptest::proptest; #[test] fn test_encode() {