Skip to content

Commit

Permalink
Rewrite a loop to use foreach instead, since it's cleaner.
Browse files Browse the repository at this point in the history
  • Loading branch information
sciguyryan committed Feb 5, 2025
1 parent 390c588 commit 4e28545
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions redox-core/src/parsing/asm_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,15 @@ impl<'a> AsmParser<'a> {

// Now we want to ensure we correctly handle any escape sequences.
// We don't want to do this for the label or declaration type arguments.
let mut arguments = escaped_args.clone();
(2..escaped_args.len()).for_each(|i| {
if let Some(s) = unescape::unescape(&arguments[i]) {
arguments[i] = s;
escaped_args.iter_mut().skip(2).for_each(|arg| {
if let Some(s) = unescape::unescape(arg) {
*arg = s
}
});

let label = &arguments[0];
let args = &arguments[2..];
let declaration_type = DataDeclarationType::try_from(arguments[1].as_str())
let label = &escaped_args[0];
let args = &escaped_args[2..];
let declaration_type = DataDeclarationType::try_from(escaped_args[1].as_str())
.expect("invalid syntax - failed to identify data declaration type");

let mut storage = vec![];
Expand Down

0 comments on commit 4e28545

Please sign in to comment.