diff --git a/bytecode/src/bytecode.rs b/bytecode/src/bytecode.rs index 0a4676288..18ae446d9 100644 --- a/bytecode/src/bytecode.rs +++ b/bytecode/src/bytecode.rs @@ -9,7 +9,7 @@ use std::collections::{HashMap, HashSet}; use std::fmt; /// Sourcode location. -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct Location { row: usize, column: usize, diff --git a/compiler/src/peephole.rs b/compiler/src/peephole.rs index 3a64380bd..b85266867 100644 --- a/compiler/src/peephole.rs +++ b/compiler/src/peephole.rs @@ -15,7 +15,7 @@ impl From> for InstructionMetadata { fn from(metas: Vec) -> Self { debug_assert!(!metas.is_empty(), "`metas` must not be empty"); InstructionMetadata { - loc: metas[0].loc.clone(), + loc: metas[0].loc, labels: metas .into_iter() .flat_map(|meta| meta.labels.into_iter()) diff --git a/vm/src/frame.rs b/vm/src/frame.rs index 681d5b2d4..21c54277a 100644 --- a/vm/src/frame.rs +++ b/vm/src/frame.rs @@ -1348,7 +1348,7 @@ impl Frame { } pub fn get_lineno(&self) -> bytecode::Location { - self.code.locations[self.lasti.get()].clone() + self.code.locations[self.lasti.get()] } fn push_block(&self, typ: BlockType) {