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)?;
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');
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() {
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)
}