1
Fork 0

Rollup merge of #135269 - estebank:unneeded-into, r=compiler-errors

Remove some unnecessary `.into()` calls
This commit is contained in:
Matthias Krüger 2025-01-09 09:05:10 +01:00 committed by GitHub
commit a1cadeab68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 11 additions and 13 deletions

View file

@ -1120,7 +1120,7 @@ fn check_type_defn<'tcx>(
} else { } else {
// Evaluate the constant proactively, to emit an error if the constant has // Evaluate the constant proactively, to emit an error if the constant has
// an unconditional error. We only do so if the const has no type params. // an unconditional error. We only do so if the const has no type params.
let _ = tcx.const_eval_poly(def_id.into()); let _ = tcx.const_eval_poly(def_id);
} }
} }
let field_id = field.did.expect_local(); let field_id = field.did.expect_local();

View file

@ -1303,9 +1303,9 @@ impl UnreachablePub {
cx.effective_visibilities.effective_vis(def_id).map(|effective_vis| { cx.effective_visibilities.effective_vis(def_id).map(|effective_vis| {
effective_vis.at_level(rustc_middle::middle::privacy::Level::Reachable) effective_vis.at_level(rustc_middle::middle::privacy::Level::Reachable)
}) })
&& let parent_parent = cx.tcx.parent_module_from_def_id( && let parent_parent = cx
cx.tcx.parent_module_from_def_id(def_id.into()).into(), .tcx
) .parent_module_from_def_id(cx.tcx.parent_module_from_def_id(def_id).into())
&& *restricted_did == parent_parent.to_local_def_id() && *restricted_did == parent_parent.to_local_def_id()
&& !restricted_did.to_def_id().is_crate_root() && !restricted_did.to_def_id().is_crate_root()
{ {

View file

@ -2366,8 +2366,7 @@ fn string_to_tts_1() {
token::Ident(sym::i32, IdentIsRaw::No), token::Ident(sym::i32, IdentIsRaw::No),
sp(8, 11), sp(8, 11),
), ),
]) ]),
.into(),
), ),
TokenTree::Delimited( TokenTree::Delimited(
DelimSpan::from_pair(sp(13, 14), sp(18, 19)), DelimSpan::from_pair(sp(13, 14), sp(18, 19)),
@ -2383,8 +2382,7 @@ fn string_to_tts_1() {
), ),
// `Alone` because the `;` is followed by whitespace. // `Alone` because the `;` is followed by whitespace.
TokenTree::token_alone(token::Semi, sp(16, 17)), TokenTree::token_alone(token::Semi, sp(16, 17)),
]) ]),
.into(),
), ),
]); ]);

View file

@ -79,7 +79,7 @@ pub fn is_const_evaluatable<'tcx>(
Err( Err(
EvaluateConstErr::EvaluationFailure(e) EvaluateConstErr::EvaluationFailure(e)
| EvaluateConstErr::InvalidConstParamTy(e), | EvaluateConstErr::InvalidConstParamTy(e),
) => Err(NotConstEvaluatable::Error(e.into())), ) => Err(NotConstEvaluatable::Error(e)),
Ok(_) => Ok(()), Ok(_) => Ok(()),
} }
} }
@ -140,7 +140,7 @@ pub fn is_const_evaluatable<'tcx>(
} }
Err( Err(
EvaluateConstErr::EvaluationFailure(e) | EvaluateConstErr::InvalidConstParamTy(e), EvaluateConstErr::EvaluationFailure(e) | EvaluateConstErr::InvalidConstParamTy(e),
) => Err(NotConstEvaluatable::Error(e.into())), ) => Err(NotConstEvaluatable::Error(e)),
Ok(_) => Ok(()), Ok(_) => Ok(()),
} }
} }

View file

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

View file

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

View file

@ -502,7 +502,7 @@ impl Builder {
let id = ThreadId::new(); let id = ThreadId::new();
let my_thread = match name { let my_thread = match name {
Some(name) => Thread::new(id, name.into()), Some(name) => Thread::new(id, name),
None => Thread::new_unnamed(id), None => Thread::new_unnamed(id),
}; };