fn is_temporary(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
match &expr.kind {
ExprKind::Struct(..) | ExprKind::Tup(..) => true,
- ExprKind::Path(qpath) => {
- if let Res::Def(DefKind::Const, ..) = cx.qpath_res(qpath, expr.hir_id) {
- true
- } else {
- false
- }
- },
+ ExprKind::Path(qpath) => matches!(cx.qpath_res(qpath, expr.hir_id), Res::Def(DefKind::Const, ..)),
_ => false,
}
}