Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLii

Some `let chains` clean-up

Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one

r? compiler
This commit is contained in:
bors
2025-07-28 05:25:23 +00:00
77 changed files with 1115 additions and 1209 deletions

View File

@@ -3369,12 +3369,12 @@ fn warn_if_linked_with_gold(sess: &Session, path: &Path) -> Result<(), Box<dyn s
let section =
elf.sections(endian, data)?.section_by_name(endian, b".note.gnu.gold-version");
if let Some((_, section)) = section {
if let Some(mut notes) = section.notes(endian, data)? {
return Ok(notes.any(|note| {
note.is_ok_and(|note| note.n_type(endian) == elf::NT_GNU_GOLD_VERSION)
}));
}
if let Some((_, section)) = section
&& let Some(mut notes) = section.notes(endian, data)?
{
return Ok(notes.any(|note| {
note.is_ok_and(|note| note.n_type(endian) == elf::NT_GNU_GOLD_VERSION)
}));
}
Ok(false)

View File

@@ -496,17 +496,15 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
)
.with_note("Rustc requires this item to have a specific mangled name.")
.with_span_label(tcx.def_span(did), "should be the internal language item");
if let Some(lang_item) = lang_item {
if let Some(link_name) = lang_item.link_name() {
err = err
.with_note("If you are trying to prevent mangling to ease debugging, many")
.with_note(format!(
"debuggers support a command such as `rbreak {link_name}` to"
))
.with_note(format!(
"match `.*{link_name}.*` instead of `break {link_name}` on a specific name"
))
}
if let Some(lang_item) = lang_item
&& let Some(link_name) = lang_item.link_name()
{
err = err
.with_note("If you are trying to prevent mangling to ease debugging, many")
.with_note(format!("debuggers support a command such as `rbreak {link_name}` to"))
.with_note(format!(
"match `.*{link_name}.*` instead of `break {link_name}` on a specific name"
))
}
err.emit();
}