Adopt let else in more places
This commit is contained in:
@@ -310,10 +310,7 @@ impl<'a> LlvmArchiveBuilder<'a> {
|
||||
if let Some(archive) = self.src_archive() {
|
||||
for child in archive.iter() {
|
||||
let child = child.map_err(string_to_io_error)?;
|
||||
let child_name = match child.name() {
|
||||
Some(s) => s,
|
||||
None => continue,
|
||||
};
|
||||
let Some(child_name) = child.name() else { continue };
|
||||
if removals.iter().any(|r| r == child_name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -826,20 +826,14 @@ pub(crate) unsafe fn codegen(
|
||||
let input =
|
||||
unsafe { slice::from_raw_parts(input_ptr as *const u8, input_len as usize) };
|
||||
|
||||
let input = match str::from_utf8(input) {
|
||||
Ok(s) => s,
|
||||
Err(_) => return 0,
|
||||
};
|
||||
let Ok(input) = str::from_utf8(input) else { return 0 };
|
||||
|
||||
let output = unsafe {
|
||||
slice::from_raw_parts_mut(output_ptr as *mut u8, output_len as usize)
|
||||
};
|
||||
let mut cursor = io::Cursor::new(output);
|
||||
|
||||
let demangled = match rustc_demangle::try_demangle(input) {
|
||||
Ok(d) => d,
|
||||
Err(_) => return 0,
|
||||
};
|
||||
let Ok(demangled) = rustc_demangle::try_demangle(input) else { return 0 };
|
||||
|
||||
if write!(cursor, "{:#}", demangled).is_err() {
|
||||
// Possible only if provided buffer is not big enough
|
||||
|
||||
Reference in New Issue
Block a user