1
Fork 0

large_assignments: Lint on specific large args passed to functions

This commit is contained in:
Martin Nordholts 2023-10-07 14:34:29 +02:00 committed by Martin Nordholts
parent 16ba56c242
commit 8f440f06c6
5 changed files with 134 additions and 41 deletions

View file

@ -229,6 +229,18 @@ impl<'tcx> Operand<'tcx> {
Operand::Constant(c) => c.const_.ty(),
}
}
pub fn span<D: ?Sized>(&self, local_decls: &D) -> Span
where
D: HasLocalDecls<'tcx>,
{
match self {
&Operand::Copy(ref l) | &Operand::Move(ref l) => {
local_decls.local_decls()[l.local].source_info.span
}
Operand::Constant(c) => c.span,
}
}
}
impl<'tcx> BinOp {