mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Remove unnecessary cloning
This commit is contained in:
parent
c9c4053eed
commit
5125063a21
7 changed files with 54 additions and 50 deletions
|
@ -98,16 +98,16 @@ pub enum Operand {
|
|||
}
|
||||
|
||||
impl Operand {
|
||||
fn from_concrete_const(data: Vec<u8>, memory_map: MemoryMap, ty: Ty) -> Self {
|
||||
fn from_concrete_const(data: Box<[u8]>, memory_map: MemoryMap, ty: Ty) -> Self {
|
||||
Operand::Constant(intern_const_scalar(ConstScalar::Bytes(data, memory_map), ty))
|
||||
}
|
||||
|
||||
fn from_bytes(data: Vec<u8>, ty: Ty) -> Self {
|
||||
fn from_bytes(data: Box<[u8]>, ty: Ty) -> Self {
|
||||
Operand::from_concrete_const(data, MemoryMap::default(), ty)
|
||||
}
|
||||
|
||||
fn const_zst(ty: Ty) -> Operand {
|
||||
Self::from_bytes(vec![], ty)
|
||||
Self::from_bytes(Box::default(), ty)
|
||||
}
|
||||
|
||||
fn from_fn(
|
||||
|
@ -118,7 +118,7 @@ impl Operand {
|
|||
let ty =
|
||||
chalk_ir::TyKind::FnDef(CallableDefId::FunctionId(func_id).to_chalk(db), generic_args)
|
||||
.intern(Interner);
|
||||
Operand::from_bytes(vec![], ty)
|
||||
Operand::from_bytes(Box::default(), ty)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue