rustc_middle: clippy fixes

This commit is contained in:
Marijn Schouten 2025-09-05 17:44:53 +00:00
parent ad85bc524b
commit ad21f439dc
3 changed files with 14 additions and 20 deletions

View file

@ -579,7 +579,7 @@ impl<'tcx> Display for Const<'tcx> {
}
///////////////////////////////////////////////////////////////////////////
/// Const-related utilities
// Const-related utilities
impl<'tcx> TyCtxt<'tcx> {
pub fn span_as_caller_location(self, span: Span) -> ConstValue {

View file

@ -408,14 +408,14 @@ impl<'tcx> Place<'tcx> {
self.as_ref().project_deeper(more_projections, tcx)
}
pub fn ty_from<D: ?Sized>(
pub fn ty_from<D>(
local: Local,
projection: &[PlaceElem<'tcx>],
local_decls: &D,
tcx: TyCtxt<'tcx>,
) -> PlaceTy<'tcx>
where
D: HasLocalDecls<'tcx>,
D: ?Sized + HasLocalDecls<'tcx>,
{
PlaceTy::from_ty(local_decls.local_decls()[local].ty).multi_projection_ty(tcx, projection)
}
@ -529,9 +529,9 @@ impl<'tcx> PlaceRef<'tcx> {
Place { local: self.local, projection: tcx.mk_place_elems(new_projections) }
}
pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> PlaceTy<'tcx>
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> PlaceTy<'tcx>
where
D: HasLocalDecls<'tcx>,
D: ?Sized + HasLocalDecls<'tcx>,
{
Place::ty_from(self.local, self.projection, local_decls, tcx)
}
@ -630,9 +630,9 @@ impl<'tcx> Operand<'tcx> {
if let ty::FnDef(def_id, args) = *const_ty.kind() { Some((def_id, args)) } else { None }
}
pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
where
D: HasLocalDecls<'tcx>,
D: ?Sized + HasLocalDecls<'tcx>,
{
match self {
&Operand::Copy(ref l) | &Operand::Move(ref l) => l.ty(local_decls, tcx).ty,
@ -640,9 +640,9 @@ impl<'tcx> Operand<'tcx> {
}
}
pub fn span<D: ?Sized>(&self, local_decls: &D) -> Span
pub fn span<D>(&self, local_decls: &D) -> Span
where
D: HasLocalDecls<'tcx>,
D: ?Sized + HasLocalDecls<'tcx>,
{
match self {
&Operand::Copy(ref l) | &Operand::Move(ref l) => {
@ -674,7 +674,7 @@ impl<'tcx> ConstOperand<'tcx> {
}
///////////////////////////////////////////////////////////////////////////
/// Rvalues
// Rvalues
pub enum RvalueInitializationState {
Shallow,
@ -721,9 +721,9 @@ impl<'tcx> Rvalue<'tcx> {
}
}
pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
where
D: HasLocalDecls<'tcx>,
D: ?Sized + HasLocalDecls<'tcx>,
{
match *self {
Rvalue::Use(ref operand) => operand.ty(local_decls, tcx),

View file

@ -216,10 +216,7 @@ impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::ParamEnv<'tcx> {
#[inline]
fn decode_arena_allocable<'tcx, D: TyDecoder<'tcx>, T: ArenaAllocatable<'tcx> + Decodable<D>>(
decoder: &mut D,
) -> &'tcx T
where
D: TyDecoder<'tcx>,
{
) -> &'tcx T {
decoder.interner().arena.alloc(Decodable::decode(decoder))
}
@ -230,10 +227,7 @@ fn decode_arena_allocable_slice<
T: ArenaAllocatable<'tcx> + Decodable<D>,
>(
decoder: &mut D,
) -> &'tcx [T]
where
D: TyDecoder<'tcx>,
{
) -> &'tcx [T] {
decoder.interner().arena.alloc_from_iter(<Vec<T> as Decodable<D>>::decode(decoder))
}