Fix fp in unnecessary_safety_comment
This commit is contained in:
parent
d29c4c9f63
commit
1a7ef02dcb
2 changed files with 29 additions and 0 deletions
|
|
@ -263,6 +263,18 @@ fn expr_has_unnecessary_safety_comment<'tcx>(
|
|||
expr: &'tcx hir::Expr<'tcx>,
|
||||
comment_pos: BytePos,
|
||||
) -> Option<Span> {
|
||||
if cx.tcx.hir().parent_iter(expr.hir_id).any(|(_, ref node)| {
|
||||
matches!(
|
||||
node,
|
||||
Node::Block(&Block {
|
||||
rules: BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided),
|
||||
..
|
||||
}),
|
||||
)
|
||||
}) {
|
||||
return None;
|
||||
}
|
||||
|
||||
// this should roughly be the reverse of `block_parents_have_safety_comment`
|
||||
if for_each_expr_with_closures(cx, expr, |expr| match expr.kind {
|
||||
hir::ExprKind::Block(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue