Swap type checked expression
Instead of type checking the entire expression (causing a false positive), only type check for a subset of the expression (the receiver of the matched function: `take()`)
This commit is contained in:
parent
8b2b343b23
commit
b52bc9b96b
1 changed files with 1 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ use super::NEEDLESS_OPTION_TAKE;
|
|||
|
||||
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, recv: &'tcx Expr<'_>) {
|
||||
// Checks if expression type is equal to sym::Option and if the expr is not a syntactic place
|
||||
if is_expr_option(cx, expr) && !expr.is_syntactic_place_expr() {
|
||||
if is_expr_option(cx, recv) && !recv.is_syntactic_place_expr() {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue