Skip to content

Commit 7dc8f23

Browse files
committed
part: cargo clippy --fix -- -W clippy::pedantic
Signed-off-by: Daniel Maslowski <[email protected]>
1 parent c057cf1 commit 7dc8f23

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/part/fpt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl<'a> FPT {
342342

343343
pub fn get_sorted_entries(&self) -> Vec<FPTEntry> {
344344
let mut entries = self.entries.clone();
345-
entries.sort_by_key(|e| e.offset());
345+
entries.sort_by_key(FPTEntry::offset);
346346
entries
347347
}
348348

@@ -389,7 +389,7 @@ impl<'a> FPT {
389389
self.entries.as_bytes(),
390390
]
391391
.concat();
392-
let mut res = all.to_vec();
392+
let mut res = all.clone();
393393
res.resize(self.original_size, EMPTY);
394394
res
395395
}

src/part/partitions.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Partitions {
4343

4444
pub fn get_sorted_entries(&self) -> Vec<FPTEntry> {
4545
let mut entries = self.get_entries().clone();
46-
entries.sort_by_key(|e| e.offset());
46+
entries.sort_by_key(super::fpt::FPTEntry::offset);
4747
entries
4848
}
4949

@@ -125,7 +125,7 @@ impl Partitions {
125125
Partitions::Gen3(res)
126126
}
127127
Partitions::Unknown(p) => {
128-
let res = p.to_vec();
128+
let res = p.clone();
129129
Partitions::Unknown(res)
130130
}
131131
};
@@ -136,17 +136,17 @@ impl Partitions {
136136
pub fn get_sorted(&self) -> Self {
137137
match self {
138138
Partitions::Gen2(parts) => {
139-
let mut parts = parts.to_vec();
139+
let mut parts = parts.clone();
140140
parts.sort_by_key(|p| p.entry().offset());
141141
Partitions::Gen2(parts)
142142
}
143143
Partitions::Gen3(parts) => {
144-
let mut parts = parts.to_vec();
144+
let mut parts = parts.clone();
145145
parts.sort_by_key(|p| p.entry().offset());
146146
Partitions::Gen3(parts)
147147
}
148148
Partitions::Unknown(parts) => {
149-
let mut parts = parts.to_vec();
149+
let mut parts = parts.clone();
150150
parts.sort_by_key(|p| p.entry().offset());
151151
Partitions::Unknown(parts)
152152
}
@@ -162,7 +162,7 @@ impl Partitions {
162162
{
163163
return Err(format!("Cannot relocate partition: {e}"));
164164
}
165-
Partitions::Gen2(parts.to_vec())
165+
Partitions::Gen2(parts.clone())
166166
}
167167
Partitions::Gen3(parts) => {
168168
let p = parts.iter_mut().find(|p| p.entry().name() == part_name);
@@ -171,10 +171,10 @@ impl Partitions {
171171
{
172172
return Err(format!("Cannot relocate partition: {e}"));
173173
}
174-
Partitions::Gen3(parts.to_vec())
174+
Partitions::Gen3(parts.clone())
175175
}
176176
Partitions::Unknown(parts) => {
177-
let parts = parts.to_vec();
177+
let parts = parts.clone();
178178
Partitions::Unknown(parts)
179179
}
180180
};
@@ -242,7 +242,7 @@ impl Partitions {
242242
&parts.iter().map(|p| p as &dyn Partition).collect(),
243243
&mut data,
244244
),
245-
};
245+
}
246246

247247
Ok(data)
248248
} else {

0 commit comments

Comments
 (0)