Skip to content

Commit

Permalink
utilize carrier
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Aug 29, 2018
1 parent 2fa7351 commit 2a48652
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions clippy_lints/src/ptr_offset_with_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,9 @@ fn build_suggestion<'a, 'tcx>(
receiver_expr: &hir::Expr,
cast_lhs_expr: &hir::Expr,
) -> Option<String> {
match (
utils::snippet_opt(cx, receiver_expr.span),
utils::snippet_opt(cx, cast_lhs_expr.span)
) {
(Some(receiver), Some(cast_lhs)) => {
Some(format!("{}.{}({})", receiver, method.suggestion(), cast_lhs))
},
_ => None,
}
let receiver = utils::snippet_opt(cx, receiver_expr.span)?;
let cast_lhs = utils::snippet_opt(cx, cast_lhs_expr.span)?;
Some(format!("{}.{}({})", receiver, method.suggestion(), cast_lhs))
}

enum Method {
Expand Down

0 comments on commit 2a48652

Please sign in to comment.