Skip to content

Commit

Permalink
Remove usage of extern crate (#330)
Browse files Browse the repository at this point in the history
This is no longer necessary in recent versions of Rust.

Co-authored-by: Leonardo Razovic <leorazzo@gmail.com>
  • Loading branch information
mrobinson and lrazovic authored Nov 15, 2023
1 parent 71422cd commit 863b267
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 37 deletions.
10 changes: 0 additions & 10 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(test)]

extern crate ipc_channel;
extern crate test;

/// Allows doing multiple inner iterations per bench.iter() run.
Expand All @@ -14,12 +12,8 @@ extern crate test;
const ITERATIONS: usize = 1;

mod platform {
extern crate crossbeam_utils;

use crate::ITERATIONS;
use ipc_channel::platform;

use crate::test;
use std::sync::{mpsc, Mutex};

#[bench]
Expand Down Expand Up @@ -182,8 +176,6 @@ mod ipc {
use crate::ITERATIONS;
use ipc_channel::ipc;

use crate::test;

#[bench]
fn transfer_empty(b: &mut test::Bencher) {
let (tx, rx) = ipc::channel().unwrap();
Expand Down Expand Up @@ -269,8 +261,6 @@ mod ipc {
use crate::ITERATIONS;
use ipc_channel::ipc::{self, IpcReceiverSet};

use crate::test;

// Benchmark selecting over a set of `n` receivers,
// with `to_send` of them actually having pending data.
fn bench_send_on_m_of_n(b: &mut test::Bencher, to_send: usize, n: usize) {
Expand Down
1 change: 1 addition & 0 deletions src/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use futures::stream::FusedStream;
use futures::task::Context;
use futures::task::Poll;
use futures::Stream;
use lazy_static::lazy_static;
use serde::Deserialize;
use serde::Serialize;
use std::collections::HashMap;
Expand Down
28 changes: 1 addition & 27 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,19 @@
//! [OsIpcSharedMemory]: platform/struct.OsIpcSharedMemory.html
//! [memfd_create]: http://man7.org/linux/man-pages/man2/memfd_create.2.html
extern crate bincode;
extern crate crossbeam_channel;

#[macro_use]
extern crate lazy_static;
#[cfg(all(
not(feature = "force-inprocess"),
any(target_os = "linux", target_os = "openbsd", target_os = "freebsd")
))]
extern crate fnv;
extern crate libc;
#[cfg(all(
not(feature = "force-inprocess"),
any(target_os = "linux", target_os = "openbsd", target_os = "freebsd")
))]
extern crate mio;
extern crate rand;
extern crate serde;
extern crate tempfile;
#[cfg(any(
feature = "force-inprocess",
target_os = "windows",
target_os = "android",
target_os = "ios"
))]
extern crate uuid;
#[cfg(all(
feature = "memfd",
not(feature = "force-inprocess"),
target_os = "linux"
))]
#[macro_use]
extern crate sc;

#[cfg(feature = "async")]
extern crate futures;

#[cfg(all(feature = "async", test))]
extern crate futures_test;
use futures;

#[cfg(feature = "async")]
pub mod asynch;
Expand Down
1 change: 1 addition & 0 deletions src/platform/inprocess/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use crate::ipc;
use bincode;
use crossbeam_channel::{self, Receiver, RecvTimeoutError, Select, Sender, TryRecvError};
use lazy_static::lazy_static;
use std::cell::{Ref, RefCell};
use std::cmp::PartialEq;
use std::collections::hash_map::HashMap;
Expand Down
1 change: 1 addition & 0 deletions src/platform/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use self::mach_sys::{mach_port_right_t, mach_port_t, mach_task_self_, vm_inherit
use crate::ipc;

use bincode;
use lazy_static::lazy_static;
use libc::{self, c_char, c_uint, c_void, size_t};
use rand::{self, Rng};
use std::cell::Cell;
Expand Down
1 change: 1 addition & 0 deletions src/platform/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ fn with_n_fds(n: usize, size: usize) {
mod fragment_tests {
use super::with_n_fds;
use crate::platform;
use lazy_static::lazy_static;

lazy_static! {
static ref FRAGMENT_SIZE: usize = { platform::OsIpcSender::get_max_fragment_size() };
Expand Down
3 changes: 3 additions & 0 deletions src/platform/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
use crate::ipc;
use bincode;
use fnv::FnvHasher;
use lazy_static::lazy_static;
use libc::{self, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE, SOCK_SEQPACKET, SOL_SOCKET};
use libc::{c_char, c_int, c_void, getsockopt, SO_LINGER, S_IFMT, S_IFSOCK};
use libc::{iovec, mode_t, msghdr, off_t, recvmsg, sendmsg};
use libc::{sa_family_t, setsockopt, size_t, sockaddr, sockaddr_un, socketpair, socklen_t};
use libc::{EAGAIN, EWOULDBLOCK};
use mio::unix::SourceFd;
use mio::{Events, Interest, Poll, Token};
#[cfg(all(feature = "memfd", target_os = "linux"))]
use sc::syscall;
use std::cell::Cell;
use std::cmp;
use std::collections::HashMap;
Expand Down
1 change: 1 addition & 0 deletions src/platform/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use crate::ipc;
use bincode;
use lazy_static::lazy_static;
use serde;

use std::{
Expand Down
1 change: 1 addition & 0 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//! `IpcReceiver<T>`s. The router will then either call the appropriate callback or route the
//! message to a crossbeam `Sender<T>` or `Receiver<T>`. You should use the global `ROUTER` to
//! access the `RouterProxy` methods (via `ROUTER`'s `Deref` for `RouterProxy`.
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::sync::Mutex;
use std::thread;
Expand Down

0 comments on commit 863b267

Please sign in to comment.