1
Fork 0

Changes from code review

This commit is contained in:
ltdk 2022-06-05 22:24:14 -04:00
parent 5fabdb8f7f
commit 9473e21955
4 changed files with 56 additions and 23 deletions

View file

@ -317,14 +317,15 @@ impl CheckAttrVisitor<'_> {
Target::Mod | Target::ForeignMod | Target::Impl | Target::Trait => {
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
lint.build("`#[no_coverage]` cannot be done recursively and must be applied to functions directly").emit();
lint.build("`#[no_coverage]` does not propagate into items and must be applied to the contained functions directly").emit();
});
true
}
Target::Expression | Target::Statement | Target::Arm => {
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
lint.build("`#[no_coverage]` can only be applied at the function level, not on code directly").emit();
lint.build("`#[no_coverage]` may only be applied to function definitions")
.emit();
});
true
}