5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-24 02:04:14 +03:00

more stable clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-08-01 12:04:38 +02:00
parent 75ecc27907
commit 5574114a2a
4 changed files with 15 additions and 13 deletions

View File

@ -384,8 +384,9 @@ impl<R: BufRead> NetworkParser<R> {
if mask.is_some() {
// address already has a mask - ignore netmask
} else {
use std::fmt::Write as _;
check_netmask(netmask, is_v6)?;
cidr.push_str(&format!("/{}", netmask));
let _ = write!(cidr, "/{}", netmask);
}
if is_v6 {
set_cidr_v6(interface, cidr)?;

View File

@ -637,12 +637,9 @@ pub struct TaskListInfo {
fn render_task_line(info: &TaskListInfo) -> String {
let mut raw = String::new();
if let Some(status) = &info.state {
raw.push_str(&format!(
"{} {:08X} {}\n",
info.upid_str,
status.endtime(),
status
));
use std::fmt::Write as _;
let _ = writeln!(raw, "{} {:08X} {}", info.upid_str, status.endtime(), status);
} else {
raw.push_str(&info.upid_str);
raw.push('\n');

View File

@ -174,12 +174,13 @@ pub fn update_dns(
let mut data = String::new();
use std::fmt::Write as _;
if let Some(search) = config["search"].as_str() {
data.push_str(&format!("search {}\n", search));
let _ = writeln!(data, "search {}", search);
}
for opt in &["dns1", "dns2", "dns3"] {
if let Some(server) = config[opt].as_str() {
data.push_str(&format!("nameserver {}\n", server));
let _ = writeln!(data, "nameserver {}", server);
}
}
if let Some(options) = config["options"].as_str() {

View File

@ -476,21 +476,24 @@ pub fn send_load_media_email(
to: &str,
reason: Option<String>,
) -> Result<(), Error> {
use std::fmt::Write as _;
let subject = format!("Load Media '{}' request for drive '{}'", label_text, drive);
let mut text = String::new();
if let Some(reason) = reason {
text.push_str(&format!(
let _ = write!(
text,
"The drive has the wrong or no tape inserted. Error:\n{}\n\n",
reason
));
);
}
text.push_str("Please insert the requested media into the backup drive.\n\n");
text.push_str(&format!("Drive: {}\n", drive));
text.push_str(&format!("Media: {}\n", label_text));
let _ = writeln!(text, "Drive: {}", drive);
let _ = writeln!(text, "Media: {}", label_text);
send_job_status_mail(to, &subject, &text)
}