Skip to content

Commit a1cadea

Browse files
authored
Rollup merge of rust-lang#135269 - estebank:unneeded-into, r=compiler-errors
Remove some unnecessary `.into()` calls
2 parents b593085 + eb917ea commit a1cadea

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ fn check_type_defn<'tcx>(
11201120
} else {
11211121
// Evaluate the constant proactively, to emit an error if the constant has
11221122
// an unconditional error. We only do so if the const has no type params.
1123-
let _ = tcx.const_eval_poly(def_id.into());
1123+
let _ = tcx.const_eval_poly(def_id);
11241124
}
11251125
}
11261126
let field_id = field.did.expect_local();

compiler/rustc_lint/src/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1303,9 +1303,9 @@ impl UnreachablePub {
13031303
cx.effective_visibilities.effective_vis(def_id).map(|effective_vis| {
13041304
effective_vis.at_level(rustc_middle::middle::privacy::Level::Reachable)
13051305
})
1306-
&& let parent_parent = cx.tcx.parent_module_from_def_id(
1307-
cx.tcx.parent_module_from_def_id(def_id.into()).into(),
1308-
)
1306+
&& let parent_parent = cx
1307+
.tcx
1308+
.parent_module_from_def_id(cx.tcx.parent_module_from_def_id(def_id).into())
13091309
&& *restricted_did == parent_parent.to_local_def_id()
13101310
&& !restricted_did.to_def_id().is_crate_root()
13111311
{

compiler/rustc_parse/src/parser/tests.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,7 @@ fn string_to_tts_1() {
23662366
token::Ident(sym::i32, IdentIsRaw::No),
23672367
sp(8, 11),
23682368
),
2369-
])
2370-
.into(),
2369+
]),
23712370
),
23722371
TokenTree::Delimited(
23732372
DelimSpan::from_pair(sp(13, 14), sp(18, 19)),
@@ -2383,8 +2382,7 @@ fn string_to_tts_1() {
23832382
),
23842383
// `Alone` because the `;` is followed by whitespace.
23852384
TokenTree::token_alone(token::Semi, sp(16, 17)),
2386-
])
2387-
.into(),
2385+
]),
23882386
),
23892387
]);
23902388

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn is_const_evaluatable<'tcx>(
7979
Err(
8080
EvaluateConstErr::EvaluationFailure(e)
8181
| EvaluateConstErr::InvalidConstParamTy(e),
82-
) => Err(NotConstEvaluatable::Error(e.into())),
82+
) => Err(NotConstEvaluatable::Error(e)),
8383
Ok(_) => Ok(()),
8484
}
8585
}
@@ -140,7 +140,7 @@ pub fn is_const_evaluatable<'tcx>(
140140
}
141141
Err(
142142
EvaluateConstErr::EvaluationFailure(e) | EvaluateConstErr::InvalidConstParamTy(e),
143-
) => Err(NotConstEvaluatable::Error(e.into())),
143+
) => Err(NotConstEvaluatable::Error(e)),
144144
Ok(_) => Ok(()),
145145
}
146146
}

library/alloc/src/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
17891789
/// let x: Rc<&str> = Rc::new("Hello, world!");
17901790
/// {
17911791
/// let s = String::from("Oh, no!");
1792-
/// let mut y: Rc<&str> = x.clone().into();
1792+
/// let mut y: Rc<&str> = x.clone();
17931793
/// unsafe {
17941794
/// // this is Undefined Behavior, because x's inner type
17951795
/// // is &'long str, not &'short str

library/alloc/src/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2468,7 +2468,7 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
24682468
/// let x: Arc<&str> = Arc::new("Hello, world!");
24692469
/// {
24702470
/// let s = String::from("Oh, no!");
2471-
/// let mut y: Arc<&str> = x.clone().into();
2471+
/// let mut y: Arc<&str> = x.clone();
24722472
/// unsafe {
24732473
/// // this is Undefined Behavior, because x's inner type
24742474
/// // is &'long str, not &'short str

library/std/src/thread/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ impl Builder {
502502

503503
let id = ThreadId::new();
504504
let my_thread = match name {
505-
Some(name) => Thread::new(id, name.into()),
505+
Some(name) => Thread::new(id, name),
506506
None => Thread::new_unnamed(id),
507507
};
508508

0 commit comments

Comments
 (0)