Skip to content

Commit

Permalink
Remove most usages of "extern crate".
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Oct 21, 2023
1 parent 8d90a0d commit 4c56ed7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
4 changes: 1 addition & 3 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#![feature(test)]
#![allow(deprecated)]

#[macro_use]
extern crate smallvec;
extern crate test;

use self::test::Bencher;
use smallvec::{ExtendFromSlice, SmallVec};
use smallvec::{ExtendFromSlice, smallvec, SmallVec};

const VEC_SIZE: usize = 16;
const SPILLED_SIZE: usize = 100;
Expand Down
10 changes: 2 additions & 8 deletions fuzz/fuzz_targets/smallvec_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,20 @@ fn do_test_all(data: &[u8]) {
do_test::<[u8; 8]>(data);
}

#[cfg(feature = "afl")]
#[macro_use]
extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
afl::fuzz!(|data| {
// Remove the panic hook so we can actually catch panic
// See https://github.com/rust-fuzz/afl.rs/issues/150
std::panic::set_hook(Box::new(|_| {}));
do_test_all(data);
});
}

#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {
honggfuzz::fuzz!(|data| {
// Remove the panic hook so we can actually catch panic
// See https://github.com/rust-fuzz/afl.rs/issues/150
std::panic::set_hook(Box::new(|_| {}));
Expand Down
15 changes: 5 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ use core::mem::ManuallyDrop;
/// - Create a [`SmallVec`] containing a given list of elements:
///
/// ```
/// # #[macro_use] extern crate smallvec;
/// # use smallvec::SmallVec;
/// # use smallvec::{smallvec, SmallVec};
/// # fn main() {
/// let v: SmallVec<[_; 128]> = smallvec![1, 2, 3];
/// assert_eq!(v[0], 1);
Expand All @@ -162,8 +161,7 @@ use core::mem::ManuallyDrop;
/// - Create a [`SmallVec`] from a given element and size:
///
/// ```
/// # #[macro_use] extern crate smallvec;
/// # use smallvec::SmallVec;
/// # use smallvec::{smallvec, SmallVec};
/// # fn main() {
/// let v: SmallVec<[_; 0x8000]> = smallvec![1; 3];
/// assert_eq!(v, SmallVec::from_buf([1, 1, 1]));
Expand Down Expand Up @@ -209,8 +207,7 @@ macro_rules! smallvec {
/// - Create a [`SmallVec`] containing a given list of elements:
///
/// ```
/// # #[macro_use] extern crate smallvec;
/// # use smallvec::SmallVec;
/// # use smallvec::{smallvec_inline, SmallVec};
/// # fn main() {
/// const V: SmallVec<[i32; 3]> = smallvec_inline![1, 2, 3];
/// assert_eq!(V[0], 1);
Expand All @@ -222,8 +219,7 @@ macro_rules! smallvec {
/// - Create a [`SmallVec`] from a given element and size:
///
/// ```
/// # #[macro_use] extern crate smallvec;
/// # use smallvec::SmallVec;
/// # use smallvec::{smallvec_inline, SmallVec};
/// # fn main() {
/// const V: SmallVec<[i32; 3]> = smallvec_inline![1; 3];
/// assert_eq!(V, SmallVec::from_buf([1, 1, 1]));
Expand Down Expand Up @@ -1666,8 +1662,7 @@ impl<A: Array> SmallVec<A> {
/// # Examples
///
/// ```
/// # #[macro_use] extern crate smallvec;
/// # use smallvec::SmallVec;
/// # use smallvec::{smallvec, SmallVec};
/// use std::mem;
/// use std::ptr;
///
Expand Down
5 changes: 1 addition & 4 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,13 +832,10 @@ fn test_write() {
assert_eq!(small_vec.as_ref(), data.as_ref());
}

#[cfg(feature = "serde")]
extern crate bincode;

#[cfg(feature = "serde")]
#[test]
fn test_serde() {
use self::bincode::{config, deserialize};
use bincode::{config, deserialize};
let mut small_vec: SmallVec<[i32; 2]> = SmallVec::new();
small_vec.push(1);
let encoded = config().limit(100).serialize(&small_vec).unwrap();
Expand Down

0 comments on commit 4c56ed7

Please sign in to comment.