clippy: avoid useless format!

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-01-19 10:54:37 +01:00
parent 38556bf60d
commit 3b82f3eea5
5 changed files with 12 additions and 12 deletions

View File

@ -730,7 +730,7 @@ pub fn update_inventory(
let label_text_list = changer.online_media_label_texts()?; let label_text_list = changer.online_media_label_texts()?;
if label_text_list.is_empty() { if label_text_list.is_empty() {
worker.log(format!("changer device does not list any media labels")); worker.log("changer device does not list any media labels".to_string());
} }
let state_path = Path::new(TAPE_STATUS_DIR); let state_path = Path::new(TAPE_STATUS_DIR);

View File

@ -389,7 +389,7 @@ fn restore_chunk_archive<'a>(
// check if this is an aborted stream without end marker // check if this is an aborted stream without end marker
if let Ok(false) = reader.has_end_marker() { if let Ok(false) = reader.has_end_marker() {
worker.log(format!("missing stream end marker")); worker.log("missing stream end marker".to_string());
return Ok(None); return Ok(None);
} }

View File

@ -581,16 +581,16 @@ async fn schedule_task_log_rotate() {
false, false,
move |worker| { move |worker| {
job.start(&worker.upid().to_string())?; job.start(&worker.upid().to_string())?;
worker.log(format!("starting task log rotation")); worker.log("starting task log rotation".to_string());
let result = try_block!({ let result = try_block!({
let max_size = 512 * 1024 - 1; // an entry has ~ 100b, so > 5000 entries/file let max_size = 512 * 1024 - 1; // an entry has ~ 100b, so > 5000 entries/file
let max_files = 20; // times twenty files gives > 100000 task entries let max_files = 20; // times twenty files gives > 100000 task entries
let has_rotated = rotate_task_log_archive(max_size, true, Some(max_files))?; let has_rotated = rotate_task_log_archive(max_size, true, Some(max_files))?;
if has_rotated { if has_rotated {
worker.log(format!("task log archive was rotated")); worker.log("task log archive was rotated".to_string());
} else { } else {
worker.log(format!("task log archive was not rotated")); worker.log("task log archive was not rotated".to_string());
} }
let max_size = 32 * 1024 * 1024 - 1; let max_size = 32 * 1024 * 1024 - 1;
@ -601,18 +601,18 @@ async fn schedule_task_log_rotate() {
if logrotate.rotate(max_size, None, Some(max_files))? { if logrotate.rotate(max_size, None, Some(max_files))? {
println!("rotated access log, telling daemons to re-open log file"); println!("rotated access log, telling daemons to re-open log file");
proxmox_backup::tools::runtime::block_on(command_reopen_logfiles())?; proxmox_backup::tools::runtime::block_on(command_reopen_logfiles())?;
worker.log(format!("API access log was rotated")); worker.log("API access log was rotated".to_string());
} else { } else {
worker.log(format!("API access log was not rotated")); worker.log("API access log was not rotated".to_string());
} }
let mut logrotate = LogRotate::new(buildcfg::API_AUTH_LOG_FN, true) let mut logrotate = LogRotate::new(buildcfg::API_AUTH_LOG_FN, true)
.ok_or_else(|| format_err!("could not get API auth log file names"))?; .ok_or_else(|| format_err!("could not get API auth log file names"))?;
if logrotate.rotate(max_size, None, Some(max_files))? { if logrotate.rotate(max_size, None, Some(max_files))? {
worker.log(format!("API authentication log was rotated")); worker.log("API authentication log was rotated".to_string());
} else { } else {
worker.log(format!("API authentication log was not rotated")); worker.log("API authentication log was not rotated".to_string());
} }
Ok(()) Ok(())

View File

@ -391,7 +391,7 @@ pub fn request_and_load_media(
} }
Ok((None, _)) => { Ok((None, _)) => {
if last_media_uuid.is_some() { if last_media_uuid.is_some() {
worker.log(format!("found empty media without label (please label all tapes first)")); worker.log("found empty media without label (please label all tapes first)".to_string());
last_media_uuid = None; last_media_uuid = None;
} }
} }

View File

@ -426,7 +426,7 @@ fn write_chunk_archive<'a>(
} }
if writer.bytes_written() > max_size { if writer.bytes_written() > max_size {
worker.log(format!("Chunk Archive max size reached, closing archive")); worker.log("Chunk Archive max size reached, closing archive".to_string());
break; break;
} }
} }
@ -472,7 +472,7 @@ fn update_media_set_label(
match old_set { match old_set {
None => { None => {
worker.log(format!("wrinting new media set label")); worker.log("wrinting new media set label".to_string());
drive.write_media_set_label(new_set, key_config.as_ref())?; drive.write_media_set_label(new_set, key_config.as_ref())?;
media_catalog = MediaCatalog::overwrite(status_path, media_id, false)?; media_catalog = MediaCatalog::overwrite(status_path, media_id, false)?;
} }