summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-10-26 21:15:40 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-10-29 14:46:36 +0100
commit5771f612cf84e0c4e2f8e1ccf3d921a3840adaf9 (patch)
treea3c42105d142437c2d1a75062eb9ae2f49322381
parentbf92da29c67e457a4edf542922a0bd33ebe11203 (diff)
downloadmullvadvpn-5771f612cf84e0c4e2f8e1ccf3d921a3840adaf9.tar.xz
mullvadvpn-5771f612cf84e0c4e2f8e1ccf3d921a3840adaf9.zip
Remove a number of #[macro_use] in favor of new way of importing
-rw-r--r--mullvad-cli/src/cmds/account.rs2
-rw-r--r--mullvad-cli/src/cmds/auto_connect.rs2
-rw-r--r--mullvad-cli/src/cmds/lan.rs2
-rw-r--r--mullvad-cli/src/cmds/relay.rs2
-rw-r--r--mullvad-cli/src/main.rs3
-rw-r--r--mullvad-daemon/src/cli.rs2
-rw-r--r--mullvad-daemon/src/main.rs2
-rw-r--r--mullvad-daemon/src/system_service.rs2
-rw-r--r--mullvad-problem-report/src/main.rs22
-rw-r--r--mullvad-rpc/src/lib.rs17
-rw-r--r--mullvad-tests/src/lib.rs3
-rw-r--r--mullvad-types/src/auth_failed.rs1
-rw-r--r--mullvad-types/src/lib.rs3
-rw-r--r--talpid-core/src/lib.rs2
-rw-r--r--talpid-core/src/security/linux/dns/resolvconf.rs4
-rw-r--r--talpid-core/src/security/linux/dns/systemd_resolved.rs10
-rw-r--r--talpid-core/src/security/linux/mod.rs1
-rw-r--r--talpid-core/src/security/mod.rs2
-rw-r--r--talpid-ipc/tests/ipc-client-server.rs2
19 files changed, 41 insertions, 43 deletions
diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs
index 1beee454c7..24b86817dd 100644
--- a/mullvad-cli/src/cmds/account.rs
+++ b/mullvad-cli/src/cmds/account.rs
@@ -1,4 +1,4 @@
-use clap;
+use clap::{self, value_t_or_exit};
use {new_rpc_client, Command, Result};
use mullvad_types::account::AccountToken;
diff --git a/mullvad-cli/src/cmds/auto_connect.rs b/mullvad-cli/src/cmds/auto_connect.rs
index 5d043f0f9b..bde829694e 100644
--- a/mullvad-cli/src/cmds/auto_connect.rs
+++ b/mullvad-cli/src/cmds/auto_connect.rs
@@ -1,4 +1,4 @@
-use clap;
+use clap::{self, value_t_or_exit};
use new_rpc_client;
use {Command, Result};
diff --git a/mullvad-cli/src/cmds/lan.rs b/mullvad-cli/src/cmds/lan.rs
index 2c833533cf..dffcc70a2e 100644
--- a/mullvad-cli/src/cmds/lan.rs
+++ b/mullvad-cli/src/cmds/lan.rs
@@ -1,4 +1,4 @@
-use clap;
+use clap::{self, value_t_or_exit};
use {new_rpc_client, Command, Result};
pub struct Lan;
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs
index e056505069..f6838427ec 100644
--- a/mullvad-cli/src/cmds/relay.rs
+++ b/mullvad-cli/src/cmds/relay.rs
@@ -1,4 +1,4 @@
-use clap;
+use clap::{self, value_t};
use std::str::FromStr;
use {new_rpc_client, Command, Result, ResultExt};
diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs
index d83556197e..68d4bf7194 100644
--- a/mullvad-cli/src/main.rs
+++ b/mullvad-cli/src/main.rs
@@ -6,7 +6,6 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-#[macro_use]
extern crate clap;
extern crate env_logger;
extern crate futures;
@@ -20,7 +19,7 @@ extern crate talpid_types;
mod cmds;
-
+use clap::{crate_authors, crate_description, crate_name, crate_version};
use mullvad_ipc_client::{new_standalone_ipc_client, DaemonRpcClient};
use std::alloc::System;
diff --git a/mullvad-daemon/src/cli.rs b/mullvad-daemon/src/cli.rs
index 573236d797..d1dcd66a73 100644
--- a/mullvad-daemon/src/cli.rs
+++ b/mullvad-daemon/src/cli.rs
@@ -1,4 +1,4 @@
-use clap::{App, Arg};
+use clap::{crate_authors, crate_description, crate_name, App, Arg};
use log;
use version;
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index d06f0101e1..fe91aa6413 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -7,7 +7,6 @@
//! the License, or (at your option) any later version.
extern crate chrono;
-#[macro_use]
extern crate clap;
#[macro_use]
extern crate error_chain;
@@ -21,7 +20,6 @@ extern crate mullvad_paths;
extern crate talpid_core;
#[cfg(windows)]
-#[macro_use]
extern crate windows_service;
use error_chain::ChainedError;
diff --git a/mullvad-daemon/src/system_service.rs b/mullvad-daemon/src/system_service.rs
index 6a2d54b326..e919d734cd 100644
--- a/mullvad-daemon/src/system_service.rs
+++ b/mullvad-daemon/src/system_service.rs
@@ -31,7 +31,7 @@ pub fn run() -> Result<()> {
.chain_err(|| "Failed to start a service dispatcher")
}
-define_windows_service!(service_main, handle_service_main);
+windows_service::define_windows_service!(service_main, handle_service_main);
pub fn handle_service_main(_arguments: Vec<OsString>) {
info!("Service started.");
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index 022d93bda1..9b9fc754ad 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -6,13 +6,11 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-#[macro_use]
extern crate clap;
extern crate dirs;
#[macro_use]
extern crate error_chain;
extern crate env_logger;
-#[macro_use]
extern crate lazy_static;
extern crate regex;
extern crate uuid;
@@ -20,17 +18,21 @@ extern crate uuid;
extern crate mullvad_paths;
extern crate mullvad_rpc;
+use clap::crate_authors;
use error_chain::ChainedError;
+use lazy_static::lazy_static;
use regex::Regex;
-use std::alloc::System;
-use std::borrow::Cow;
-use std::cmp::min;
-use std::collections::{HashMap, HashSet};
-use std::ffi::OsStr;
-use std::fs::{self, File};
-use std::io::{self, BufWriter, Read, Seek, SeekFrom, Write};
-use std::path::{Path, PathBuf};
+use std::{
+ alloc::System,
+ borrow::Cow,
+ cmp::min,
+ collections::{HashMap, HashSet},
+ ffi::OsStr,
+ fs::{self, File},
+ io::{self, BufWriter, Read, Seek, SeekFrom, Write},
+ path::{Path, PathBuf},
+};
#[global_allocator]
diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs
index 7d5728d159..2bfa98ee6c 100644
--- a/mullvad-rpc/src/lib.rs
+++ b/mullvad-rpc/src/lib.rs
@@ -15,7 +15,6 @@ extern crate hyper_openssl;
#[macro_use]
extern crate jsonrpc_client_core;
extern crate jsonrpc_client_http;
-#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
@@ -28,19 +27,19 @@ use chrono::offset::Utc;
use chrono::DateTime;
use jsonrpc_client_http::header::Host;
use jsonrpc_client_http::{HttpTransport, HttpTransportBuilder};
+use lazy_static::lazy_static;
use tokio_core::reactor::Handle;
pub use jsonrpc_client_core::{Error, ErrorKind};
pub use jsonrpc_client_http::{Error as HttpError, HttpHandle};
-use mullvad_types::account::AccountToken;
-use mullvad_types::relay_list::RelayList;
-use mullvad_types::version;
-
-use std::collections::HashMap;
-use std::net::{IpAddr, Ipv4Addr};
-use std::path::{Path, PathBuf};
-use std::time::Duration;
+use mullvad_types::{account::AccountToken, relay_list::RelayList, version};
+use std::{
+ collections::HashMap,
+ net::{IpAddr, Ipv4Addr},
+ path::{Path, PathBuf},
+ time::Duration,
+};
pub mod event_loop;
pub mod rest;
diff --git a/mullvad-tests/src/lib.rs b/mullvad-tests/src/lib.rs
index 2a10ff5f3f..d8dd46a243 100644
--- a/mullvad-tests/src/lib.rs
+++ b/mullvad-tests/src/lib.rs
@@ -1,4 +1,3 @@
-#[macro_use]
extern crate duct;
extern crate jsonrpc_client_core;
extern crate jsonrpc_client_ipc;
@@ -287,7 +286,7 @@ impl DaemonRunner {
let rpc_socket_path = temp_dir.path().join("rpc_socket");
- let expression = cmd!(DAEMON_EXECUTABLE_PATH, "-v", "--disable-log-to-file")
+ let expression = duct::cmd!(DAEMON_EXECUTABLE_PATH, "-v", "--disable-log-to-file")
.dir("..")
.env("MULLVAD_CACHE_DIR", cache_dir)
.env("MULLVAD_RPC_SOCKET_PATH", rpc_socket_path.clone())
diff --git a/mullvad-types/src/auth_failed.rs b/mullvad-types/src/auth_failed.rs
index d53de2d136..55bc4247ea 100644
--- a/mullvad-types/src/auth_failed.rs
+++ b/mullvad-types/src/auth_failed.rs
@@ -1,3 +1,4 @@
+use lazy_static::lazy_static;
use regex::Regex;
#[derive(Debug)]
diff --git a/mullvad-types/src/lib.rs b/mullvad-types/src/lib.rs
index 749da41353..927b26ff37 100644
--- a/mullvad-types/src/lib.rs
+++ b/mullvad-types/src/lib.rs
@@ -17,11 +17,8 @@ extern crate talpid_types;
#[macro_use]
extern crate log;
-
#[macro_use]
extern crate error_chain;
-
-#[macro_use]
extern crate lazy_static;
diff --git a/talpid-core/src/lib.rs b/talpid-core/src/lib.rs
index 596f6a6d6c..ed21df7fec 100644
--- a/talpid-core/src/lib.rs
+++ b/talpid-core/src/lib.rs
@@ -11,7 +11,6 @@
//! the License, or (at your option) any later version.
extern crate atty;
-#[macro_use]
extern crate duct;
#[macro_use]
extern crate log;
@@ -27,7 +26,6 @@ extern crate jsonrpc_core;
#[macro_use]
extern crate jsonrpc_macros;
#[cfg(unix)]
-#[macro_use]
extern crate lazy_static;
extern crate libc;
extern crate shell_escape;
diff --git a/talpid-core/src/security/linux/dns/resolvconf.rs b/talpid-core/src/security/linux/dns/resolvconf.rs
index d1ac319edb..b8238fab0d 100644
--- a/talpid-core/src/security/linux/dns/resolvconf.rs
+++ b/talpid-core/src/security/linux/dns/resolvconf.rs
@@ -45,7 +45,7 @@ impl Resolvconf {
record_contents.push('\n');
}
- let output = cmd!(&self.resolvconf, "-a", &record_name)
+ let output = duct::cmd!(&self.resolvconf, "-a", &record_name)
.input(record_contents)
.run()
.chain_err(|| ErrorKind::RunResolvconf)?;
@@ -64,7 +64,7 @@ impl Resolvconf {
let mut result = Ok(());
for record_name in self.record_names.drain() {
- let output = cmd!(&self.resolvconf, "-d", &record_name)
+ let output = duct::cmd!(&self.resolvconf, "-d", &record_name)
.run()
.chain_err(|| ErrorKind::RunResolvconf)?;
diff --git a/talpid-core/src/security/linux/dns/systemd_resolved.rs b/talpid-core/src/security/linux/dns/systemd_resolved.rs
index 5558ce2279..af84de8a81 100644
--- a/talpid-core/src/security/linux/dns/systemd_resolved.rs
+++ b/talpid-core/src/security/linux/dns/systemd_resolved.rs
@@ -1,11 +1,13 @@
extern crate dbus;
-use std::fs;
-use std::net::{IpAddr, Ipv4Addr};
-use std::path::Path;
-
use error_chain::ChainedError;
+use lazy_static::lazy_static;
use libc::{AF_INET, AF_INET6};
+use std::{
+ fs,
+ net::{IpAddr, Ipv4Addr},
+ path::Path,
+};
use self::dbus::arg::RefArg;
use self::dbus::stdintf::*;
diff --git a/talpid-core/src/security/linux/mod.rs b/talpid-core/src/security/linux/mod.rs
index c892b24ee3..f0b20f84de 100644
--- a/talpid-core/src/security/linux/mod.rs
+++ b/talpid-core/src/security/linux/mod.rs
@@ -3,6 +3,7 @@ extern crate mnl;
use error_chain::ChainedError;
use ipnetwork::IpNetwork;
+use lazy_static::lazy_static;
use libc;
use nftnl::{
self,
diff --git a/talpid-core/src/security/mod.rs b/talpid-core/src/security/mod.rs
index 36b058e5e1..53198ade9e 100644
--- a/talpid-core/src/security/mod.rs
+++ b/talpid-core/src/security/mod.rs
@@ -1,5 +1,7 @@
#[cfg(unix)]
use ipnetwork::{Ipv4Network, Ipv6Network};
+#[cfg(unix)]
+use lazy_static::lazy_static;
use std::fmt;
#[cfg(unix)]
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
diff --git a/talpid-ipc/tests/ipc-client-server.rs b/talpid-ipc/tests/ipc-client-server.rs
index 24781db081..a0efdc4f9c 100644
--- a/talpid-ipc/tests/ipc-client-server.rs
+++ b/talpid-ipc/tests/ipc-client-server.rs
@@ -1,4 +1,3 @@
-#[macro_use]
extern crate assert_matches;
extern crate env_logger;
extern crate jsonrpc_client_core;
@@ -12,6 +11,7 @@ extern crate uuid;
extern crate futures;
+use assert_matches::assert_matches;
use futures::sync::oneshot;
use futures::Future;