now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple

was previously failing due to `check` having to many arguments.
This commit is contained in:
darklyspaced 2023-06-26 14:05:41 +08:00
parent c60222dc12
commit b832175b2d
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -3906,7 +3906,7 @@ impl Methods {
manual_saturating_arithmetic::check(cx, expr, lhs, rhs, u_arg, &arith["checked_".len()..]);
},
Some(("map", m_recv, [m_arg], span, _)) => {
option_map_unwrap_or::check(cx, expr, m_recv, m_arg, recv, u_arg, span, &self.msrv);
option_map_unwrap_or::check(cx, expr, m_recv, m_arg, (recv, u_arg), span, &self.msrv);
},
Some(("then_some", t_recv, [t_arg], _, _)) => {
obfuscated_if_else::check(cx, expr, t_recv, t_arg, u_arg);

View file

@ -25,11 +25,11 @@ pub(super) fn check<'tcx>(
expr: &rustc_hir::Expr<'_>,
recv: &rustc_hir::Expr<'_>,
map_arg: &'tcx rustc_hir::Expr<'_>,
unwrap_recv: &rustc_hir::Expr<'_>,
unwrap_arg: &'tcx rustc_hir::Expr<'_>,
unwrap: (&rustc_hir::Expr<'_>, &'tcx rustc_hir::Expr<'_>),
map_span: Span,
msrv: &Msrv,
) {
let (unwrap_recv, unwrap_arg) = unwrap;
// lint if the caller of `map()` is an `Option`
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Option) {
if !is_copy(cx, cx.typeck_results().expr_ty(unwrap_arg)) {