diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-02-28 01:55:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-28 01:55:49 +0100 |
| commit | 02b96b3ecc48dc5245e425fc248163cfaae9643e (patch) | |
| tree | bad29616a580bcc720dcbedc94715e30ee89ba01 /src/librustc | |
| parent | 4c9e44fc5f2958706fb747d7ccf4d49f1f384545 (diff) | |
| parent | 7be94a8a958750cf57c0fa41ad7797a2cd1630de (diff) | |
| download | rust-02b96b3ecc48dc5245e425fc248163cfaae9643e.tar.gz rust-02b96b3ecc48dc5245e425fc248163cfaae9643e.zip | |
Rollup merge of #69529 - matthiaskrgr:clippy_identity_conversion, r=Mark-Simulacrum
don't use .into() to convert types into identical types.
This removes redundant `.into()` calls.
example: `let s: String = format!("hello").into();`
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/tcx.rs | 2 | ||||
| -rw-r--r-- | src/librustc/traits/mod.rs | 3 |
4 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 052603f6e5e..0d0aa8a232e 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -472,7 +472,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> { val: ScalarMaybeUndef<Tag>, ) -> InterpResult<'tcx> { let ptr_size = cx.data_layout().pointer_size; - self.write_scalar(cx, ptr.into(), val, ptr_size) + self.write_scalar(cx, ptr, val, ptr_size) } } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 3086f9b04df..6a937b87645 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1519,7 +1519,7 @@ impl<'tcx> TerminatorKind<'tcx> { values .iter() .map(|&u| { - ty::Const::from_scalar(tcx, Scalar::from_uint(u, size).into(), switch_ty) + ty::Const::from_scalar(tcx, Scalar::from_uint(u, size), switch_ty) .to_string() .into() }) diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index e6c7c84494c..13996a74acb 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -156,7 +156,7 @@ impl<'tcx> Rvalue<'tcx> { } Rvalue::AddressOf(mutability, ref place) => { let place_ty = place.ty(local_decls, tcx).ty; - tcx.mk_ptr(ty::TypeAndMut { ty: place_ty, mutbl: mutability.into() }) + tcx.mk_ptr(ty::TypeAndMut { ty: place_ty, mutbl: mutability }) } Rvalue::Len(..) => tcx.types.usize, Rvalue::Cast(.., ty) => ty, diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index de2ec53e51e..b05bd26f048 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -820,8 +820,7 @@ impl ObjectSafetyViolation { MethodViolationCode::UndispatchableReceiver, span, ) => ( - format!("consider changing method `{}`'s `self` parameter to be `&self`", name) - .into(), + format!("consider changing method `{}`'s `self` parameter to be `&self`", name), Some(("&Self".to_string(), span)), ), ObjectSafetyViolation::AssocConst(name, _) |
