Skip to content

Commit 16c9851

Browse files
more let-chains!
1 parent a1a50d9 commit 16c9851

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/symbolize/gimli/elf.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ impl Mapping {
3030
let object = Object::parse(map)?;
3131

3232
// Try to locate an external debug file using the build ID.
33-
if let Some(path_debug) = object.build_id().and_then(locate_build_id) {
34-
if let Some(mapping) = Mapping::new_debug(path, path_debug, None) {
35-
return Some(Either::A(mapping));
36-
}
33+
if let Some(path_debug) = object.build_id().and_then(locate_build_id)
34+
&& let Some(mapping) = Mapping::new_debug(path, path_debug, None)
35+
{
36+
return Some(Either::A(mapping));
3737
}
3838

3939
// Try to locate an external debug file using the GNU debug link section.
40-
if let Some((path_debug, crc)) = object.gnu_debuglink_path(path) {
41-
if let Some(mapping) = Mapping::new_debug(path, path_debug, Some(crc)) {
42-
return Some(Either::A(mapping));
43-
}
40+
if let Some((path_debug, crc)) = object.gnu_debuglink_path(path)
41+
&& let Some(mapping) = Mapping::new_debug(path, path_debug, Some(crc))
42+
{
43+
return Some(Either::A(mapping));
4444
}
4545

4646
let dwp = Mapping::load_dwarf_package(path, stash);
@@ -102,14 +102,14 @@ impl Mapping {
102102

103103
// Try to locate a supplementary object file.
104104
let mut sup = None;
105-
if let Some((path_sup, build_id_sup)) = object.gnu_debugaltlink_path(&path) {
106-
if let Some(map_sup) = super::mmap(&path_sup) {
107-
let map_sup = stash.cache_mmap(map_sup);
108-
if let Some(sup_) = Object::parse(map_sup) {
109-
if sup_.build_id() == Some(build_id_sup) {
110-
sup = Some(sup_);
111-
}
112-
}
105+
if let Some((path_sup, build_id_sup)) = object.gnu_debugaltlink_path(&path)
106+
&& let Some(map_sup) = super::mmap(&path_sup)
107+
{
108+
let map_sup = stash.cache_mmap(map_sup);
109+
if let Some(sup_) = Object::parse(map_sup)
110+
&& sup_.build_id() == Some(build_id_sup)
111+
{
112+
sup = Some(sup_);
113113
}
114114
}
115115

@@ -532,10 +532,10 @@ pub(super) fn handle_split_dwarf<'data>(
532532
stash: &'data Stash,
533533
load: addr2line::SplitDwarfLoad<EndianSlice<'data, Endian>>,
534534
) -> Option<Arc<gimli::Dwarf<EndianSlice<'data, Endian>>>> {
535-
if let Some(dwp) = package.as_ref() {
536-
if let Ok(Some(cu)) = dwp.find_cu(load.dwo_id, &load.parent) {
537-
return Some(Arc::new(cu));
538-
}
535+
if let Some(dwp) = package.as_ref()
536+
&& let Ok(Some(cu)) = dwp.find_cu(load.dwo_id, &load.parent)
537+
{
538+
return Some(Arc::new(cu));
539539
}
540540

541541
let mut path = PathBuf::new();

src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'a> BytesOrWideString<'a> {
7070
if let BytesOrWideString::Bytes(b) = self
7171
&& let Ok(s) = str::from_utf8(b)
7272
{
73-
PathBuf::from(s);
73+
PathBuf::from(s)
7474
} else {
7575
// or die
7676
unreachable!()

0 commit comments

Comments
 (0)