diff options
| author | Corey Farwell <coreyf@rwell.org> | 2018-08-29 07:42:43 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2018-08-29 07:42:43 -0500 |
| commit | 2a486528ee13c861679c62a5451f7118591c3531 (patch) | |
| tree | 2ac023a1b9ab6e571807f8f61fbc63f0590379fd | |
| parent | 2fa7351c1e0ca482ae13ca969be5975f1603a2b1 (diff) | |
| download | rust-2a486528ee13c861679c62a5451f7118591c3531.tar.gz rust-2a486528ee13c861679c62a5451f7118591c3531.zip | |
utilize carrier
| -rw-r--r-- | clippy_lints/src/ptr_offset_with_cast.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/clippy_lints/src/ptr_offset_with_cast.rs b/clippy_lints/src/ptr_offset_with_cast.rs index 20934573f09..08ae92d255e 100644 --- a/clippy_lints/src/ptr_offset_with_cast.rs +++ b/clippy_lints/src/ptr_offset_with_cast.rs @@ -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 { |
