summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-05-17 04:03:33 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-05-17 04:03:33 +0200
commit75e02ede09536f8c222359fc16dedf4022d84cae (patch)
tree7396070fb8060783c2c1efefb6152d10f7e7b199
parent573cc43b06730b6a4d59402e8772d06d3fd38910 (diff)
parent2774796534e9f4d98022865f0ab3ce1f82fa52cd (diff)
downloadmullvadvpn-75e02ede09536f8c222359fc16dedf4022d84cae.tar.xz
mullvadvpn-75e02ede09536f8c222359fc16dedf4022d84cae.zip
Merge branch 'use-path-display-method'
-rw-r--r--mullvad-daemon/src/account_history.rs13
-rw-r--r--mullvad-daemon/src/bin/problem-report.rs4
-rw-r--r--mullvad-daemon/src/relays.rs2
-rw-r--r--mullvad-daemon/src/rpc_address_file.rs11
-rw-r--r--mullvad-daemon/src/settings.rs6
-rw-r--r--talpid-core/src/mktemp.rs2
-rw-r--r--talpid-core/src/tunnel/mod.rs4
-rw-r--r--windows-service/examples/simple_service.rs2
8 files changed, 19 insertions, 25 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index 3d7fe209c9..201feba51b 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -14,11 +14,11 @@ error_chain! {
}
ReadError(path: PathBuf) {
description("Unable to read account history file")
- display("Unable to read account history from {}", path.to_string_lossy())
+ display("Unable to read account history from {}", path.display())
}
WriteError(path: PathBuf) {
description("Unable to write account history file")
- display("Unable to write account history to {}", path.to_string_lossy())
+ display("Unable to write account history to {}", path.display())
}
ParseError {
description("Malformed account history")
@@ -41,16 +41,13 @@ impl AccountHistory {
let history_path = Self::get_path()?;
match File::open(&history_path) {
Ok(mut file) => {
- info!(
- "Loading account history from {}",
- history_path.to_string_lossy()
- );
+ info!("Loading account history from {}", history_path.display());
Self::parse(&mut file)
}
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
info!(
"No account history file at {}, using defaults",
- history_path.to_string_lossy()
+ history_path.display()
);
Ok(AccountHistory::default())
}
@@ -89,7 +86,7 @@ impl AccountHistory {
fn save(&self) -> Result<()> {
let path = Self::get_path()?;
- debug!("Writing account history to {}", path.to_string_lossy());
+ debug!("Writing account history to {}", path.display());
let file = File::create(&path).chain_err(|| ErrorKind::WriteError(path.clone()))?;
serde_json::to_writer_pretty(file, self).chain_err(|| ErrorKind::WriteError(path))
diff --git a/mullvad-daemon/src/bin/problem-report.rs b/mullvad-daemon/src/bin/problem-report.rs
index 304d572212..2d3b30c4bc 100644
--- a/mullvad-daemon/src/bin/problem-report.rs
+++ b/mullvad-daemon/src/bin/problem-report.rs
@@ -57,11 +57,11 @@ error_chain!{
errors {
WriteReportError(path: PathBuf) {
description("Error writing the problem report file")
- display("Error writing the problem report file: {}", path.to_string_lossy())
+ display("Error writing the problem report file: {}", path.display())
}
ReadLogError(path: PathBuf) {
description("Error reading the contents of log file")
- display("Error reading the contents of log file: {}", path.to_string_lossy())
+ display("Error reading the contents of log file: {}", path.display())
}
RpcError {
description("Error during RPC call")
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs
index e13b1ebc3f..7a41316986 100644
--- a/mullvad-daemon/src/relays.rs
+++ b/mullvad-daemon/src/relays.rs
@@ -319,7 +319,7 @@ impl RelaySelector {
fn read_relays<P: AsRef<Path>>(path: P) -> Result<(SystemTime, RelayList)> {
debug!(
"Trying to read relays cache from {}",
- path.as_ref().to_string_lossy()
+ path.as_ref().display()
);
let (last_modified, file) =
Self::read_file(path.as_ref()).chain_err(|| ErrorKind::RelayCacheError)?;
diff --git a/mullvad-daemon/src/rpc_address_file.rs b/mullvad-daemon/src/rpc_address_file.rs
index a59a7eb485..25ed92daa4 100644
--- a/mullvad-daemon/src/rpc_address_file.rs
+++ b/mullvad-daemon/src/rpc_address_file.rs
@@ -13,16 +13,16 @@ error_chain! {
description("Failed to create directory for RPC connection info file")
display(
"Failed to create directory for RPC connection info file: {}",
- path.to_string_lossy(),
+ path.display(),
)
}
WriteFailed(path: PathBuf) {
description("Failed to write RPC connection info to file")
- display("Failed to write RPC connection info to {}", path.to_string_lossy())
+ display("Failed to write RPC connection info to {}", path.display())
}
RemoveFailed(path: PathBuf) {
description("Failed to remove file")
- display("Failed to remove {}", path.to_string_lossy())
+ display("Failed to remove {}", path.display())
}
}
}
@@ -43,10 +43,7 @@ pub fn write(rpc_address: &str, shared_secret: &str) -> Result<()> {
.and_then(|mut file| write!(file, "{}\n{}\n", rpc_address, shared_secret))
.chain_err(|| ErrorKind::WriteFailed(file_path.clone()))?;
- debug!(
- "Wrote RPC connection info to {}",
- file_path.to_string_lossy()
- );
+ debug!("Wrote RPC connection info to {}", file_path.display());
Ok(())
}
diff --git a/mullvad-daemon/src/settings.rs b/mullvad-daemon/src/settings.rs
index 61017dee67..d0df5efb31 100644
--- a/mullvad-daemon/src/settings.rs
+++ b/mullvad-daemon/src/settings.rs
@@ -62,13 +62,13 @@ impl Settings {
let settings_path = Self::get_settings_path()?;
match File::open(&settings_path) {
Ok(file) => {
- info!("Loading settings from {}", settings_path.to_string_lossy());
+ info!("Loading settings from {}", settings_path.display());
Self::read_settings(&mut io::BufReader::new(file))
}
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
info!(
"No settings file at {}, using defaults",
- settings_path.to_string_lossy()
+ settings_path.display()
);
Ok(Settings::default())
}
@@ -80,7 +80,7 @@ impl Settings {
fn save(&self) -> Result<()> {
let path = Self::get_settings_path()?;
- debug!("Writing settings to {}", path.to_string_lossy());
+ debug!("Writing settings to {}", path.display());
let file = File::create(&path).chain_err(|| ErrorKind::WriteError(path.clone()))?;
serde_json::to_writer_pretty(file, self).chain_err(|| ErrorKind::WriteError(path))
diff --git a/talpid-core/src/mktemp.rs b/talpid-core/src/mktemp.rs
index fc39127069..424fffe171 100644
--- a/talpid-core/src/mktemp.rs
+++ b/talpid-core/src/mktemp.rs
@@ -35,7 +35,7 @@ impl Drop for TempFile {
if e.kind() != io::ErrorKind::NotFound {
error!(
"Unable to remove temp file {}: {:?}",
- self.path.to_string_lossy(),
+ self.path.display(),
e
);
}
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 3cc21b47be..8ba7ef2740 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -205,7 +205,7 @@ impl TunnelMonitor {
path.push(library);
if path.exists() {
- debug!("Using OpenVPN plugin at {}", path.to_string_lossy());
+ debug!("Using OpenVPN plugin at {}", path.display());
Ok(path)
} else {
Err(ErrorKind::PluginNotFound.into())
@@ -253,7 +253,7 @@ impl TunnelMonitor {
let temp_file = mktemp::TempFile::new();
debug!(
"Writing user-pass credentials to {}",
- temp_file.as_ref().to_string_lossy()
+ temp_file.as_ref().display()
);
let mut file = fs::File::create(&temp_file)?;
Self::set_user_pass_file_permissions(&file)?;
diff --git a/windows-service/examples/simple_service.rs b/windows-service/examples/simple_service.rs
index 7125221d90..ee72ddbe73 100644
--- a/windows-service/examples/simple_service.rs
+++ b/windows-service/examples/simple_service.rs
@@ -74,7 +74,7 @@ mod simple_service {
}
OpenLogFile(path: PathBuf) {
description("Unable to open log file for writing")
- display("Unable to open log file for writing: {}", path.to_string_lossy())
+ display("Unable to open log file for writing: {}", path.display())
}
InitLogger {
description("Cannot initialize logger")