Don't lint literal None from expansion

This commit is contained in:
Lukas Lueg 2022-08-28 12:18:50 +02:00
parent 8d9da4d7c7
commit c542f1fe3f
4 changed files with 40 additions and 15 deletions

View file

@ -53,7 +53,8 @@ impl<'tcx> LateLintPass<'tcx> for PartialeqToNone {
// If the expression is a literal `Option::None`
let is_none_ctor = |expr: &Expr<'_>| {
matches!(&peel_hir_expr_refs(expr).0.kind,
!expr.span.from_expansion()
&& matches!(&peel_hir_expr_refs(expr).0.kind,
ExprKind::Path(p) if is_lang_ctor(cx, p, LangItem::OptionNone))
};