From a6054d2223d6dcea3168ca33f0cfba3179fa7959 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 24 Nov 2015 19:31:14 +0100 Subject: [PATCH] StorageBackendError: Use String instead of str in params --- src/storage/backend.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/storage/backend.rs b/src/storage/backend.rs index 9dd0de4a..c9c6ff4b 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -95,18 +95,18 @@ impl StorageBackend { let path = self.build_filepath(&f); if let Err(_) = FSFile::open(path) { return Ok(Err(StorageBackendError::new( - "File::open()", - &format!("Tried to open '{}'", path)[..], - "Tried to update contents of this file, though file doesn't exist", + String::from("File::open()"), + format!("Tried to open '{}'", path), + String::from("Tried to update contents of this file, though file doesn't exist"), None))) } if let Ok(mut file) = FSFile::create(path) { if let Err(writeerr) = file.write_all(&content.into_bytes()) { return Ok(Err(StorageBackendError::new( - "File::write()", - &format!("Tried to write '{}'", path)[..], - "Tried to write contents of this file, though operation did not succeed", + String::from("File::write()"), + format!("Tried to write '{}'", path), + String::from("Tried to write contents of this file, though operation did not succeed"), Some(content)))) } } @@ -152,15 +152,15 @@ pub struct StorageBackendError { } impl StorageBackendError { - fn new(action: &'static str, - desc : &'static str, - explan: &'static str, + fn new(action: String, + desc : String, + explan: String, data : Option) -> StorageBackendError { StorageBackendError { - action: String::from(action), - desc: String::from(desc), - explanation: String::from(explan), + action: action, + desc: desc, + explanation: explan, dataDump: data, } }