Skip to content

Commit

Permalink
Avoid cloning unless absolutely necesary.
Browse files Browse the repository at this point in the history
  • Loading branch information
sciguyryan committed Feb 5, 2025
1 parent 4e28545 commit 3daa6bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions redox-core/src/parsing/asm_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub struct AsmParser<'a> {
pub parsed_data_declarations: Vec<DataDeclaration>,
}

impl<'a> AsmParser<'a> {
impl AsmParser<'_> {
pub fn new() -> Self {
Self {
hints: InstructionHints::new(),
Expand Down Expand Up @@ -217,12 +217,11 @@ impl<'a> AsmParser<'a> {
let mut argument_hints = Vec::with_capacity(10);
let mut label = None;

let shortlist: Vec<InstructionLookup> = self
let shortlist: Vec<&InstructionLookup<'_>> = self
.hints
.hints
.iter()
.filter(|h| h.names.contains(&name.as_str()))
.cloned()
.collect();

assert!(
Expand Down Expand Up @@ -363,7 +362,7 @@ impl<'a> AsmParser<'a> {
.multi_cartesian_product()
.collect_vec();

let mut possible_matches: Vec<&InstructionLookup<'a>> = if !arguments.is_empty() {
let mut possible_matches: Vec<&&InstructionLookup<'_>> = if !arguments.is_empty() {
shortlist
.iter()
.filter(|sl| arg_permutations.iter().any(|perm| sl.args == *perm))
Expand Down

0 comments on commit 3daa6bf

Please sign in to comment.