Skip to content

Commit a463067

Browse files
committed
Clippy fixes
1 parent b4defb1 commit a463067

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

objdiff-core/src/arch/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl DataType {
5656
for literal in self.display_literals::<Endian>(bytes) {
5757
strs.push(format!("{}: {}", self, literal))
5858
}
59-
return strs;
59+
strs
6060
}
6161

6262
pub fn display_literals<Endian: ByteOrder>(&self, bytes: &[u8]) -> Vec<String> {
@@ -129,13 +129,13 @@ impl DataType {
129129
strs.push(format!("{:#?}", bytes));
130130
}
131131
DataType::String => {
132-
if let Some(cstr) = CStr::from_bytes_until_nul(bytes).ok() {
132+
if let Ok(cstr) = CStr::from_bytes_until_nul(bytes) {
133133
strs.push(format!("{:?}", cstr));
134134
}
135135
}
136136
}
137137

138-
return strs;
138+
strs
139139
}
140140

141141
fn required_len(&self) -> Option<usize> {
@@ -200,9 +200,9 @@ pub trait ObjArch: Send + Sync {
200200
.map(|ty| {
201201
self.display_data_labels(ty, &reloc.target.bytes[reloc.addend as usize..])
202202
})
203-
.unwrap_or_else(Vec::new);
203+
.unwrap_or_default();
204204
}
205-
return Vec::new();
205+
Vec::new()
206206
}
207207

208208
fn display_ins_data_literals(&self, ins: &ObjIns) -> Vec<String> {
@@ -215,9 +215,9 @@ pub trait ObjArch: Send + Sync {
215215
.map(|ty| {
216216
self.display_data_literals(ty, &reloc.target.bytes[reloc.addend as usize..])
217217
})
218-
.unwrap_or_else(Vec::new);
218+
.unwrap_or_default();
219219
}
220-
return Vec::new();
220+
Vec::new()
221221
}
222222

223223
// Downcast methods

0 commit comments

Comments
 (0)