Skip to content

Commit 16a4f8b

Browse files
committed
style: remove unnecessary fs path prefix in snapshotter
As `std::fs::Self` is imported in the file.
1 parent cffcf45 commit 16a4f8b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

mithril-aggregator/src/snapshotter.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl Snapshotter for CompressedArchiveSnapshotter {
9696
let archive_path = self.ongoing_snapshot_directory.join(archive_name);
9797
let filesize = self.create_and_verify_archive(&archive_path).inspect_err(|_err| {
9898
if archive_path.exists() {
99-
if let Err(remove_error) = std::fs::remove_file(&archive_path) {
99+
if let Err(remove_error) = fs::remove_file(&archive_path) {
100100
warn!(
101101
" > Post snapshotter.snapshot failure, could not remove temporary archive at path: path:{}, err: {}",
102102
archive_path.display(),
@@ -121,15 +121,15 @@ impl CompressedArchiveSnapshotter {
121121
compression_algorithm: SnapshotterCompressionAlgorithm,
122122
) -> StdResult<CompressedArchiveSnapshotter> {
123123
if ongoing_snapshot_directory.exists() {
124-
std::fs::remove_dir_all(&ongoing_snapshot_directory).with_context(|| {
124+
fs::remove_dir_all(&ongoing_snapshot_directory).with_context(|| {
125125
format!(
126126
"Can not remove snapshotter directory: '{}'.",
127127
ongoing_snapshot_directory.display()
128128
)
129129
})?;
130130
}
131131

132-
std::fs::create_dir(&ongoing_snapshot_directory).map_err(|e| {
132+
fs::create_dir(&ongoing_snapshot_directory).map_err(|e| {
133133
DependenciesBuilderError::Initialization {
134134
message: format!(
135135
"Can not create snapshotter directory: '{}'.",
@@ -147,7 +147,7 @@ impl CompressedArchiveSnapshotter {
147147
}
148148

149149
fn get_file_size(filepath: &Path) -> StdResult<u64> {
150-
let res = std::fs::metadata(filepath)
150+
let res = fs::metadata(filepath)
151151
.map_err(|e| SnapshotError::GeneralError(e.to_string()))?
152152
.len();
153153
Ok(res)
@@ -454,12 +454,7 @@ mod tests {
454454
.unwrap(),
455455
);
456456

457-
assert_eq!(
458-
0,
459-
std::fs::read_dir(pending_snapshot_directory)
460-
.unwrap()
461-
.count()
462-
);
457+
assert_eq!(0, fs::read_dir(pending_snapshot_directory).unwrap().count());
463458
}
464459

465460
#[test]
@@ -485,7 +480,7 @@ mod tests {
485480
let _ = snapshotter
486481
.snapshot("whatever.tar.gz")
487482
.expect_err("Snapshotter::snapshot should fail if the db is empty.");
488-
let remaining_files: Vec<String> = std::fs::read_dir(&pending_snapshot_directory)
483+
let remaining_files: Vec<String> = fs::read_dir(&pending_snapshot_directory)
489484
.unwrap()
490485
.map(|f| f.unwrap().file_name().to_str().unwrap().to_owned())
491486
.collect();

0 commit comments

Comments
 (0)