Skip to content

Commit

Permalink
fmt by hand
Browse files Browse the repository at this point in the history
  • Loading branch information
lengyijun committed Aug 24, 2021
1 parent d2d1794 commit d835769
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions clippy_lints/src/option_needless_deref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ impl<'tcx> LateLintPass<'tcx> for OptionNeedlessDeref {
let outer_ty = typeck.expr_ty(expr);

if_chain! {
if is_type_diagnostic_item(cx,outer_ty,sym::option_type) ||
is_type_diagnostic_item(cx,outer_ty,sym::result_type) ;
if is_type_diagnostic_item(cx,outer_ty,sym::option_type) ||
is_type_diagnostic_item(cx,outer_ty,sym::result_type) ;
if let ExprKind::MethodCall(path, _, [sub_expr], _) = expr.kind;
let symbol = &*path.ident.as_str();
if symbol=="as_deref" || symbol=="as_deref_mut";
let symbol = &*path.ident.as_str();
if symbol=="as_deref" || symbol=="as_deref_mut";
if TyS::same_type( outer_ty, typeck.expr_ty(sub_expr) );
then{

span_lint_and_sugg(
cx,
OPTION_NEEDLESS_DEREF,
Expand All @@ -64,7 +63,6 @@ impl<'tcx> LateLintPass<'tcx> for OptionNeedlessDeref {
snippet_opt(cx,sub_expr.span).unwrap(),
Applicability::MachineApplicable
);

}
}
}
Expand Down

0 comments on commit d835769

Please sign in to comment.