Rollup merge of #118727 - compiler-errors:lint-decorate, r=WaffleLapkin

Don't pass lint back out of lint decorator

Change the decorator function in the signature of the `emit_lint`/`span_lint`/etc family of methods from `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` to `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>)`. I consider it easier to read this way, especially when there's control flow involved.

r? nnethercote though feel free to reassign
This commit is contained in:
Jubilee 2023-12-15 14:08:16 -08:00 committed by GitHub
commit 58353fa458
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 53 additions and 153 deletions

View file

@ -661,7 +661,7 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes(
args.args[0].hir_id(),
multispan,
msg,
|lint| lint,
|_| {},
);
}

View file

@ -122,7 +122,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
Applicability::MachineApplicable,
);
self.maybe_lint_blanket_trait_impl(self_ty, lint);
lint
},
);
}

View file

@ -1434,8 +1434,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
format!("<{} as {}>::{}", qself_ty, tcx.item_name(trait_did), assoc_ident),
Applicability::MachineApplicable,
);
lint
},
);
}

View file

@ -51,7 +51,7 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Abi) {
hir_id,
span,
"use of calling convention not supported on this target",
|lint| lint,
|_| {},
);
}
}
@ -190,7 +190,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
"static of uninhabited type",
|lint| {
lint
.note("uninhabited statics cannot be initialized, and any access would be an immediate error")
.note("uninhabited statics cannot be initialized, and any access would be an immediate error");
},
);
}
@ -1093,7 +1093,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
"this {descr} contains `{field_ty}`, which {note}, \
and makes it not a breaking change to become \
non-zero-sized in the future."
))
));
},
)
} else {

View file

@ -574,7 +574,6 @@ fn emit_implied_wf_lint<'tcx>(
Applicability::MaybeIncorrect,
);
}
lint
},
);
}

View file

@ -276,7 +276,6 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
lint.help(format!(
"or use `{{{idx}:{default_modifier}}}` to keep the default formatting of `{default_result}`",
));
lint
},
);
}

View file

@ -45,7 +45,7 @@ fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
item.hir_id(),
path.span,
msg,
|lint| lint,
|_| {},
);
}
}

View file

@ -522,7 +522,7 @@ fn lint_auto_trait_impl<'tcx>(
format!(
"try using the same sequence of generic parameters as the {self_descr} definition",
),
)
);
},
);
}

View file

@ -279,7 +279,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
param.hir_id,
param.span,
TYPE_DEFAULT_NOT_ALLOWED,
|lint| lint,
|_| {},
);
}
Defaults::Deny => {

View file

@ -925,7 +925,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
"you can use the `'static` lifetime directly, in place of `{}`",
lifetime.ident,
);
lint.help(help)
lint.help(help);
},
);
}