Skip to content

Commit 76ca9e9

Browse files
committed
Fix clippy failures
1 parent 7886c18 commit 76ca9e9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Diff for: src/lib.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use std::{
3131

3232
use anyhow::Context;
3333

34-
use tempfile::{tempfile, NamedTempFile};
34+
use tempfile::NamedTempFile;
3535

3636
pub use bootloader_boot_config::BootConfig;
3737

@@ -71,7 +71,7 @@ impl DiskImageBuilder {
7171

7272
/// Add or replace a ramdisk to be included in the final image.
7373
pub fn set_ramdisk(&mut self, path: &Path) -> &mut Self {
74-
self.add_or_replace_file(&path, RAMDISK_FILE_NAME)
74+
self.add_or_replace_file(path, RAMDISK_FILE_NAME)
7575
}
7676

7777
/// Configures the runtime behavior of the bootloader.
@@ -106,7 +106,7 @@ impl DiskImageBuilder {
106106
self.files.insert(
107107
0,
108108
DiskImageFile {
109-
source: path.clone().to_path_buf(),
109+
source: path.to_path_buf(),
110110
destination: target.to_string(),
111111
},
112112
);
@@ -123,7 +123,7 @@ impl DiskImageBuilder {
123123
}
124124

125125
for f in self.files.as_slice() {
126-
local_map.insert(&f.destination, &f.source.as_path());
126+
local_map.insert(&f.destination, f.source.as_path());
127127
}
128128

129129
let out_file = NamedTempFile::new().context("failed to create temp file")?;
@@ -200,10 +200,7 @@ impl DiskImageBuilder {
200200

201201
for f in self.files.as_slice() {
202202
let to = tftp_path.join(f.destination.clone());
203-
let result = std::fs::copy(f.source.clone(), to);
204-
if result.is_err() {
205-
return Err(anyhow::Error::from(result.unwrap_err()));
206-
}
203+
std::fs::copy(f.source.clone(), to)?;
207204
}
208205

209206
Ok(())

0 commit comments

Comments
 (0)