1
Fork 0

Auto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #81940 (Stabilize str_split_once)
 - #82165 (Reword labels on E0308 involving async fn return type)
 - #82456 (Replaced some unwrap_or and map_or with lazy variants)
 - #82491 (Consider inexpensive inlining criteria first)
 - #82506 (Properly account for non-shorthand pattern field in unused variable lint)
 - #82535 (Set codegen thread names)
 - #82545 (rustdoc: add optional woff2 versions of FiraSans.)
 - #82549 (Revert "Update normalize.css to 8.0.1")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-02-26 19:17:00 +00:00
commit 9c09c1f7cf
53 changed files with 391 additions and 256 deletions

View file

@ -1716,7 +1716,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
} else {
self.fcx
.associated_item(def_id, name, Namespace::ValueNS)
.map_or(Vec::new(), |x| vec![x])
.map_or_else(Vec::new, |x| vec![x])
}
} else {
self.tcx.associated_items(def_id).in_definition_order().copied().collect()

View file

@ -1062,7 +1062,10 @@ fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span) {
E0533,
"expected unit struct, unit variant or constant, found {}{}",
res.descr(),
tcx.sess.source_map().span_to_snippet(span).map_or(String::new(), |s| format!(" `{}`", s)),
tcx.sess
.source_map()
.span_to_snippet(span)
.map_or_else(|_| String::new(), |s| format!(" `{}`", s)),
)
.emit();
}

View file

@ -879,7 +879,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let sm = tcx.sess.source_map();
let path_str = sm
.span_to_snippet(sm.span_until_char(pat.span, '('))
.map_or(String::new(), |s| format!(" `{}`", s.trim_end()));
.map_or_else(|_| String::new(), |s| format!(" `{}`", s.trim_end()));
let msg = format!(
"expected tuple struct or tuple variant, found {}{}",
res.descr(),

View file

@ -348,9 +348,9 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
let min_list_wb = min_list
.iter()
.map(|captured_place| {
let locatable = captured_place.info.path_expr_id.unwrap_or(
self.tcx().hir().local_def_id_to_hir_id(closure_def_id.expect_local()),
);
let locatable = captured_place.info.path_expr_id.unwrap_or_else(|| {
self.tcx().hir().local_def_id_to_hir_id(closure_def_id.expect_local())
});
self.resolve(captured_place.clone(), &locatable)
})

View file

@ -2387,7 +2387,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
.sess
.source_map()
.span_to_snippet(ast_ty.span)
.map_or(String::new(), |s| format!(" `{}`", s));
.map_or_else(|_| String::new(), |s| format!(" `{}`", s));
tcx.sess
.struct_span_err(
ast_ty.span,