1
Fork 0

Re-format let-else per rustfmt update

This commit is contained in:
Mark Rousskov 2023-07-12 21:49:27 -04:00
parent 67b0cfc761
commit cc907f80b9
162 changed files with 1404 additions and 947 deletions

View file

@ -1432,9 +1432,9 @@ impl CheckAttrVisitor<'_> {
};
let Some(ItemLike::Item(Item {
kind: ItemKind::Fn(FnSig { decl, .. }, generics, _),
..
})) = item else {
kind: ItemKind::Fn(FnSig { decl, .. }, generics, _), ..
})) = item
else {
bug!("should be a function item");
};
@ -2106,8 +2106,12 @@ impl CheckAttrVisitor<'_> {
}
let tcx = self.tcx;
let Some(token_stream_def_id) = tcx.get_diagnostic_item(sym::TokenStream) else { return; };
let Some(token_stream) = tcx.type_of(token_stream_def_id).no_bound_vars() else { return; };
let Some(token_stream_def_id) = tcx.get_diagnostic_item(sym::TokenStream) else {
return;
};
let Some(token_stream) = tcx.type_of(token_stream_def_id).no_bound_vars() else {
return;
};
let def_id = hir_id.expect_owner().def_id;
let param_env = ty::ParamEnv::empty();

View file

@ -1683,12 +1683,16 @@ impl<'tcx> Liveness<'_, 'tcx> {
opt_body: Option<&hir::Body<'_>>,
) -> Vec<errors::UnusedVariableStringInterp> {
let mut suggs = Vec::new();
let Some(opt_body) = opt_body else { return suggs; };
let Some(opt_body) = opt_body else {
return suggs;
};
let mut visitor = CollectLitsVisitor { lit_exprs: vec![] };
intravisit::walk_body(&mut visitor, opt_body);
for lit_expr in visitor.lit_exprs {
let hir::ExprKind::Lit(litx) = &lit_expr.kind else { continue };
let rustc_ast::LitKind::Str(syb, _) = litx.node else{ continue; };
let rustc_ast::LitKind::Str(syb, _) = litx.node else {
continue;
};
let name_str: &str = syb.as_str();
let name_pa = format!("{{{name}}}");
if name_str.contains(&name_pa) {

View file

@ -856,7 +856,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
/// See issue #94972 for details on why this is a special case
fn is_unstable_reexport(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
// Get the LocalDefId so we can lookup the item to check the kind.
let Some(owner) = id.as_owner() else { return false; };
let Some(owner) = id.as_owner() else {
return false;
};
let def_id = owner.def_id;
let Some(stab) = tcx.stability().local_stability(def_id) else {