From 6dc7bf9bd4e84e2bd3cc6b41bb2eba61b5d983c3 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Wed, 1 Nov 2023 17:40:11 -0700 Subject: [PATCH] clippy dings Signed-off-by: Brian L. Troutwine --- lading/src/generator/file_gen/logrotate.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lading/src/generator/file_gen/logrotate.rs b/lading/src/generator/file_gen/logrotate.rs index 9d33ee10f..c0bc4503a 100644 --- a/lading/src/generator/file_gen/logrotate.rs +++ b/lading/src/generator/file_gen/logrotate.rs @@ -16,7 +16,7 @@ //! use std::{ num::{NonZeroU32, NonZeroUsize}, - path::PathBuf, + path::{Path, PathBuf}, str, thread, }; @@ -175,7 +175,7 @@ impl Server { basename.set_extension("log"); let child = Child::new( - basename, + &basename, config.total_rotations, bytes_per_second, maximum_bytes_per_file, @@ -229,7 +229,7 @@ struct Child { impl Child { fn new( - basename: PathBuf, + basename: &Path, total_rotations: u8, bytes_per_second: NonZeroU32, maximum_bytes_per_log: NonZeroU32, @@ -241,13 +241,10 @@ impl Child { for i in 0..total_rotations { let name = format!( "{orig}.{i}", - orig = basename - .file_name() - .unwrap_or_default() - .to_string_lossy() - .to_string() + orig = basename.file_name().unwrap_or_default().to_string_lossy() ); - let mut pth = basename.clone(); + let mut pth = PathBuf::new(); + pth.push(basename); pth.set_file_name(name); names.push(pth); }