Rollup merge of #94011 - est31:let_else, r=lcnr
Even more let_else adoptions Continuation of #89933, #91018, #91481, #93046, #93590.
This commit is contained in:
commit
637d8b89e8
26 changed files with 50 additions and 104 deletions
|
@ -216,17 +216,18 @@ pub fn each_linked_rlib(
|
|||
}
|
||||
let name = &info.crate_name[&cnum];
|
||||
let used_crate_source = &info.used_crate_source[&cnum];
|
||||
let path = if let Some((path, _)) = &used_crate_source.rlib {
|
||||
path
|
||||
} else if used_crate_source.rmeta.is_some() {
|
||||
return Err(format!(
|
||||
"could not find rlib for: `{}`, found rmeta (metadata) file",
|
||||
name
|
||||
));
|
||||
if let Some((path, _)) = &used_crate_source.rlib {
|
||||
f(cnum, &path);
|
||||
} else {
|
||||
return Err(format!("could not find rlib for: `{}`", name));
|
||||
};
|
||||
f(cnum, &path);
|
||||
if used_crate_source.rmeta.is_some() {
|
||||
return Err(format!(
|
||||
"could not find rlib for: `{}`, found rmeta (metadata) file",
|
||||
name
|
||||
));
|
||||
} else {
|
||||
return Err(format!("could not find rlib for: `{}`", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -200,9 +200,7 @@ fn create_object_file(sess: &Session) -> Option<write::Object<'static>> {
|
|||
// `SHF_EXCLUDE` flag we can set on sections in an object file to get
|
||||
// automatically removed from the final output.
|
||||
pub fn create_rmeta_file(sess: &Session, metadata: &[u8]) -> Vec<u8> {
|
||||
let mut file = if let Some(file) = create_object_file(sess) {
|
||||
file
|
||||
} else {
|
||||
let Some(mut file) = create_object_file(sess) else {
|
||||
// This is used to handle all "other" targets. This includes targets
|
||||
// in two categories:
|
||||
//
|
||||
|
@ -262,9 +260,7 @@ pub fn create_compressed_metadata_file(
|
|||
) -> Vec<u8> {
|
||||
let mut compressed = rustc_metadata::METADATA_HEADER.to_vec();
|
||||
FrameEncoder::new(&mut compressed).write_all(metadata.raw_data()).unwrap();
|
||||
let mut file = if let Some(file) = create_object_file(sess) {
|
||||
file
|
||||
} else {
|
||||
let Some(mut file) = create_object_file(sess) else {
|
||||
return compressed.to_vec();
|
||||
};
|
||||
let section = file.add_section(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue