Re-format let-else per rustfmt update
This commit is contained in:
parent
67b0cfc761
commit
cc907f80b9
162 changed files with 1404 additions and 947 deletions
|
@ -741,7 +741,9 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
|||
};
|
||||
info!("panic runtime not found -- loading {}", name);
|
||||
|
||||
let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { return; };
|
||||
let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else {
|
||||
return;
|
||||
};
|
||||
let data = self.cstore.get_crate_data(cnum);
|
||||
|
||||
// Sanity check the loaded crate to ensure it is indeed a panic runtime
|
||||
|
@ -774,7 +776,9 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
|||
self.sess.emit_err(errors::ProfilerBuiltinsNeedsCore);
|
||||
}
|
||||
|
||||
let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { return; };
|
||||
let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else {
|
||||
return;
|
||||
};
|
||||
let data = self.cstore.get_crate_data(cnum);
|
||||
|
||||
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
|
||||
|
|
|
@ -804,8 +804,12 @@ fn get_metadata_section<'p>(
|
|||
}
|
||||
|
||||
// Length of the compressed stream - this allows linkers to pad the section if they want
|
||||
let Ok(len_bytes) = <[u8; 4]>::try_from(&buf[header_len..cmp::min(data_start, buf.len())]) else {
|
||||
return Err(MetadataError::LoadFailure("invalid metadata length found".to_string()));
|
||||
let Ok(len_bytes) =
|
||||
<[u8; 4]>::try_from(&buf[header_len..cmp::min(data_start, buf.len())])
|
||||
else {
|
||||
return Err(MetadataError::LoadFailure(
|
||||
"invalid metadata length found".to_string(),
|
||||
));
|
||||
};
|
||||
let compressed_len = u32::from_be_bytes(len_bytes) as usize;
|
||||
|
||||
|
|
|
@ -311,8 +311,10 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> {
|
|||
#[inline]
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
let Some(tcx) = self.tcx else {
|
||||
bug!("No TyCtxt found for decoding. \
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`.");
|
||||
bug!(
|
||||
"No TyCtxt found for decoding. \
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."
|
||||
);
|
||||
};
|
||||
tcx
|
||||
}
|
||||
|
@ -448,8 +450,10 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for SyntaxContext {
|
|||
let cdata = decoder.cdata();
|
||||
|
||||
let Some(sess) = decoder.sess else {
|
||||
bug!("Cannot decode SyntaxContext without Session.\
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`.");
|
||||
bug!(
|
||||
"Cannot decode SyntaxContext without Session.\
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."
|
||||
);
|
||||
};
|
||||
|
||||
let cname = cdata.root.name();
|
||||
|
@ -470,8 +474,10 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for ExpnId {
|
|||
let local_cdata = decoder.cdata();
|
||||
|
||||
let Some(sess) = decoder.sess else {
|
||||
bug!("Cannot decode ExpnId without Session. \
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`.");
|
||||
bug!(
|
||||
"Cannot decode ExpnId without Session. \
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."
|
||||
);
|
||||
};
|
||||
|
||||
let cnum = CrateNum::decode(decoder);
|
||||
|
@ -521,8 +527,10 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
|
|||
let hi = lo + len;
|
||||
|
||||
let Some(sess) = decoder.sess else {
|
||||
bug!("Cannot decode Span without Session. \
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`.")
|
||||
bug!(
|
||||
"Cannot decode Span without Session. \
|
||||
You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."
|
||||
)
|
||||
};
|
||||
|
||||
// Index of the file in the corresponding crate's list of encoded files.
|
||||
|
|
|
@ -1671,7 +1671,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
fn encode_info_for_macro(&mut self, def_id: LocalDefId) {
|
||||
let tcx = self.tcx;
|
||||
|
||||
let hir::ItemKind::Macro(ref macro_def, _) = tcx.hir().expect_item(def_id).kind else { bug!() };
|
||||
let hir::ItemKind::Macro(ref macro_def, _) = tcx.hir().expect_item(def_id).kind else {
|
||||
bug!()
|
||||
};
|
||||
self.tables.is_macro_rules.set(def_id.local_def_index, macro_def.macro_rules);
|
||||
record!(self.tables.macro_definition[def_id.to_def_id()] <- &*macro_def.body);
|
||||
}
|
||||
|
@ -1911,7 +1913,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
FxHashMap::default();
|
||||
|
||||
for id in tcx.hir().items() {
|
||||
let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else { continue; };
|
||||
let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else {
|
||||
continue;
|
||||
};
|
||||
let def_id = id.owner_id.to_def_id();
|
||||
|
||||
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
|
||||
|
|
|
@ -323,7 +323,7 @@ impl<T> FixedSizeEncoding for Option<LazyValue<T>> {
|
|||
impl<T> LazyArray<T> {
|
||||
#[inline]
|
||||
fn write_to_bytes_impl(self, b: &mut [u8; 8]) {
|
||||
let ([position_bytes, meta_bytes],[])= b.as_chunks_mut::<4>() else { panic!() };
|
||||
let ([position_bytes, meta_bytes], []) = b.as_chunks_mut::<4>() else { panic!() };
|
||||
|
||||
let position = self.position.get();
|
||||
let position: u32 = position.try_into().unwrap();
|
||||
|
@ -346,7 +346,7 @@ impl<T> FixedSizeEncoding for LazyArray<T> {
|
|||
|
||||
#[inline]
|
||||
fn from_bytes(b: &[u8; 8]) -> Self {
|
||||
let ([position_bytes, meta_bytes],[])= b.as_chunks::<4>() else { panic!() };
|
||||
let ([position_bytes, meta_bytes], []) = b.as_chunks::<4>() else { panic!() };
|
||||
if *meta_bytes == [0; 4] {
|
||||
return Default::default();
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ impl<T> FixedSizeEncoding for Option<LazyArray<T>> {
|
|||
|
||||
#[inline]
|
||||
fn from_bytes(b: &[u8; 8]) -> Self {
|
||||
let ([position_bytes, meta_bytes],[])= b.as_chunks::<4>() else { panic!() };
|
||||
let ([position_bytes, meta_bytes], []) = b.as_chunks::<4>() else { panic!() };
|
||||
LazyArray::from_bytes_impl(position_bytes, meta_bytes)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue