summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorinitard <solo@softwareag.com>2022-06-10 09:56:50 +0100
committerinitard <solo@softwareag.com>2022-06-14 12:42:53 +0100
commitb83884d5e49d9a2853cf36a51557ed55fe0225da (patch)
treeaea0791f519b7e370820150abfb5223e156b6da6
parentc42bd55cfd809903e5a46e3afc23aa80e25609f5 (diff)
tedge_test_utils fixing clippy warnings #825
Signed-off-by: initard <solo@softwareag.com>
-rw-r--r--crates/tests/tedge_test_utils/src/fs.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/tests/tedge_test_utils/src/fs.rs b/crates/tests/tedge_test_utils/src/fs.rs
index 45ed9ff0..8a1bb0e4 100644
--- a/crates/tests/tedge_test_utils/src/fs.rs
+++ b/crates/tests/tedge_test_utils/src/fs.rs
@@ -15,8 +15,8 @@ pub struct TempTedgeFile {
file_path: PathBuf,
}
-impl TempTedgeDir {
- pub fn new() -> Self {
+impl Default for TempTedgeDir {
+ fn default() -> Self {
let temp_dir = TempDir::new().unwrap();
let current_file_path = temp_dir.path().to_path_buf();
TempTedgeDir {
@@ -24,12 +24,16 @@ impl TempTedgeDir {
current_file_path,
}
}
+}
+
+impl TempTedgeDir {
+ pub fn new() -> Self {
+ Self::default()
+ }
pub fn dir(&self, directory_name: &str) -> TempTedgeDir {
let root = self.temp_dir.path().to_path_buf();
- let path = root
- .join(self.current_file_path.to_path_buf())
- .join(directory_name);
+ let path = root.join(&self.current_file_path).join(directory_name);
if !path.exists() {
let () = fs::create_dir(&path).unwrap();
@@ -43,9 +47,7 @@ impl TempTedgeDir {
pub fn file(&self, file_name: &str) -> TempTedgeFile {
let root = self.temp_dir.path().to_path_buf();
- let path = root
- .join(self.current_file_path.to_path_buf())
- .join(file_name);
+ let path = root.join(&self.current_file_path).join(file_name);
if !path.exists() {
let _file = fs::File::create(&path).unwrap();