summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-12-13 14:56:43 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-12-13 14:56:43 +0100
commit89799a638bd4ba1787c6edfebd50bccb8f6c30fb (patch)
treeaaa8755e92e9037f0adb08bfa7709c486e3ac6dd
parent8985aa3c5f030460fed35c704f91c4462aac66c1 (diff)
downloadmullvadvpn-89799a638bd4ba1787c6edfebd50bccb8f6c30fb.tar.xz
mullvadvpn-89799a638bd4ba1787c6edfebd50bccb8f6c30fb.zip
Upgrade mullvad-problem-report to Rust 2018
-rw-r--r--mullvad-problem-report/Cargo.toml1
-rw-r--r--mullvad-problem-report/build.rs9
-rw-r--r--mullvad-problem-report/src/main.rs19
-rw-r--r--mullvad-problem-report/src/metadata.rs7
4 files changed, 8 insertions, 28 deletions
diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml
index 7dd510d4ea..4dbf879370 100644
--- a/mullvad-problem-report/Cargo.toml
+++ b/mullvad-problem-report/Cargo.toml
@@ -11,6 +11,7 @@ authors = [
]
description = "Collect Mullvad VPN logs into a report and send it to support"
license = "GPL-3.0"
+edition = "2018"
[[bin]]
name = "problem-report"
diff --git a/mullvad-problem-report/build.rs b/mullvad-problem-report/build.rs
index e806ed4361..93e8577394 100644
--- a/mullvad-problem-report/build.rs
+++ b/mullvad-problem-report/build.rs
@@ -1,11 +1,4 @@
-use std::env;
-use std::fs;
-use std::path::PathBuf;
-
-#[cfg(windows)]
-extern crate winapi;
-#[cfg(windows)]
-extern crate winres;
+use std::{env, fs, path::PathBuf};
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index be288aaf53..6c9fad194a 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -6,25 +6,13 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-extern crate clap;
-extern crate dirs;
#[macro_use]
extern crate error_chain;
-extern crate env_logger;
-extern crate lazy_static;
-extern crate regex;
-extern crate tokio_core;
-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 tokio_core::reactor::Core;
-
use std::{
alloc::System,
borrow::Cow,
@@ -35,6 +23,7 @@ use std::{
io::{self, BufWriter, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
};
+use tokio_core::reactor::Core;
#[global_allocator]
@@ -343,21 +332,21 @@ impl ProblemReport {
self.redact_custom_strings(&out3).to_string()
}
- fn redact_account_number(input: &str) -> Cow<str> {
+ fn redact_account_number(input: &str) -> Cow<'_, str> {
lazy_static! {
static ref RE: Regex = Regex::new("\\d{16}").unwrap();
}
RE.replace_all(input, "[REDACTED ACCOUNT NUMBER]")
}
- fn redact_home_dir(input: &str) -> Cow<str> {
+ fn redact_home_dir(input: &str) -> Cow<'_, str> {
match dirs::home_dir() {
Some(home) => Cow::from(input.replace(home.to_string_lossy().as_ref(), "~")),
None => Cow::from(input),
}
}
- fn redact_network_info(input: &str) -> Cow<str> {
+ fn redact_network_info(input: &str) -> Cow<'_, str> {
lazy_static! {
static ref RE: Regex = {
let boundary = "[^0-9a-zA-Z.:]";
diff --git a/mullvad-problem-report/src/metadata.rs b/mullvad-problem-report/src/metadata.rs
index cddbe57892..92de1940e1 100644
--- a/mullvad-problem-report/src/metadata.rs
+++ b/mullvad-problem-report/src/metadata.rs
@@ -1,6 +1,5 @@
-use std::collections::HashMap;
-use std::process::Command;
-use uuid;
+use std::{collections::HashMap, process::Command};
+
pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
@@ -17,8 +16,6 @@ pub fn collect() -> HashMap<String, String> {
#[cfg(target_os = "linux")]
mod os {
- extern crate rs_release;
-
pub fn version() -> String {
// The OS version information is obtained first from the os-release file. If that
// information is incomplete or unavailable, an attempt is made to obtain the