1
Fork 0

if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r)

This commit is contained in:
Maybe Waffle 2023-02-15 11:43:41 +00:00
parent af3c8b2726
commit 8751fa1a9a
54 changed files with 159 additions and 281 deletions

View file

@ -32,11 +32,8 @@ fn collect_item(tcx: TyCtxt<'_>, items: &mut DiagnosticItems, name: Symbol, item
if let Some(original_def_id) = items.name_to_id.insert(name, item_def_id) {
if original_def_id != item_def_id {
let orig_span = tcx.hir().span_if_local(original_def_id);
let orig_crate_name = if orig_span.is_some() {
None
} else {
Some(tcx.crate_name(original_def_id.krate))
};
let orig_crate_name =
orig_span.is_none().then(|| tcx.crate_name(original_def_id.krate));
match tcx.hir().span_if_local(item_def_id) {
Some(span) => tcx.sess.emit_err(DuplicateDiagnosticItem { span, name }),
None => tcx.sess.emit_err(DuplicateDiagnosticItemInCrate {

View file

@ -281,7 +281,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
self.recurse_with_stability_attrs(
depr.map(|(d, _)| DeprecationEntry::local(d, def_id)),
stab,
if inherit_const_stability.yes() { const_stab } else { None },
inherit_const_stability.yes().then(|| const_stab).flatten(),
visit_children,
);
}