Update code based on PR comments

This patch does the following:
- Refactor some repeated lines into a single one
- Split the `ungated_async_fn_caller` lint into multiple lines, and make
  one of those lines only print out on nightly
- Use test revisions instead of copying an existing test
This commit is contained in:
Bryan Garza 2022-11-24 03:39:47 +00:00
parent 04926e0534
commit dc2c4ce578
8 changed files with 51 additions and 106 deletions

View file

@ -1404,10 +1404,16 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
if let Some(attr) = maybe_track_caller {
cx.struct_span_lint(
UNGATED_ASYNC_FN_TRACK_CALLER,
span.with_hi(attr.span.hi()),
attr.span,
fluent::lint_ungated_async_fn_track_caller,
|lint| lint,
);
|lint| {
lint.span_label(span, "this function will not propagate the caller location");
if cx.tcx.sess.is_nightly_build() {
lint.span_suggestion(attr.span, fluent::suggestion, "#[closure_track_caller]", Applicability::MachineApplicable);
}
lint
}
);
}
}
}