1
Fork 0

Move ty::print methods to Drop-based scope guards

This commit is contained in:
Mark Rousskov 2022-02-16 13:04:48 -05:00
parent 393fdc1048
commit 9763486034
30 changed files with 142 additions and 142 deletions

View file

@ -2634,7 +2634,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
// We are extremely conservative with what we warn about.
let conjured_ty = cx.typeck_results().expr_ty(expr);
if let Some((msg, span)) =
with_no_trimmed_paths(|| ty_find_init_error(cx.tcx, conjured_ty, init))
with_no_trimmed_paths!(ty_find_init_error(cx.tcx, conjured_ty, init))
{
cx.struct_span_lint(INVALID_VALUE, expr.span, |lint| {
let mut err = lint.build(&format!(

View file

@ -994,7 +994,7 @@ impl<'tcx> LateContext<'tcx> {
}
// This shouldn't ever be needed, but just in case:
with_no_trimmed_paths(|| {
with_no_trimmed_paths!({
Ok(vec![match trait_ref {
Some(trait_ref) => Symbol::intern(&format!("{:?}", trait_ref)),
None => Symbol::intern(&format!("<{}>", self_ty)),
@ -1013,15 +1013,15 @@ impl<'tcx> LateContext<'tcx> {
// This shouldn't ever be needed, but just in case:
path.push(match trait_ref {
Some(trait_ref) => with_no_trimmed_paths(|| {
Symbol::intern(&format!(
Some(trait_ref) => {
with_no_trimmed_paths!(Symbol::intern(&format!(
"<impl {} for {}>",
trait_ref.print_only_trait_path(),
self_ty
))
}),
)))
}
None => {
with_no_trimmed_paths(|| Symbol::intern(&format!("<impl {}>", self_ty)))
with_no_trimmed_paths!(Symbol::intern(&format!("<impl {}>", self_ty)))
}
});