diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-04-24 15:04:10 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-04-24 15:04:10 +0200 |
| commit | 11790d769b9dc651f3218bdfe40da59c7c9d400e (patch) | |
| tree | f9d5182d17fac871a9f7efa92c94053e49e48e87 /lib/xixanta/src/assembler.rs | |
| parent | d95c68d8913d3ac434d86a681d215bd0da230b44 (diff) | |
| download | tools.nes-11790d769b9dc651f3218bdfe40da59c7c9d400e.tar.gz tools.nes-11790d769b9dc651f3218bdfe40da59c7c9d400e.zip | |
Update the code style to the latest stable Rust
This mostly involves applying the collapsible_match rule[1] where
appropiate, and using sort_by_key() as pointed out by the latest stable
version of clippy.
[1] https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#collapsible_match
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib/xixanta/src/assembler.rs')
| -rw-r--r-- | lib/xixanta/src/assembler.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs index 8ad72b2..cf11de1 100644 --- a/lib/xixanta/src/assembler.rs +++ b/lib/xixanta/src/assembler.rs @@ -669,11 +669,10 @@ impl<'a> Assembler<'a> { self.macros.entry(name.value.clone()).or_insert(node); } } - ControlType::EndMacro => { - if self.macros_seen > 0 { + ControlType::EndMacro + if self.macros_seen > 0 => { self.macros_seen -= 1; } - } // Same as NodeType::Label. ControlType::StartProc => { if self.macros_seen > 0 || self.procs_seen > 0 || self.repeats_seen > 0 @@ -706,12 +705,11 @@ impl<'a> Assembler<'a> { errors.push(err); } } - ControlType::EndProc => { + ControlType::EndProc // Same case as with macros. - if self.procs_seen > 0 { + if self.procs_seen > 0 => { self.procs_seen -= 1; } - } ControlType::StartScope => { if self.macros_seen > 0 || self.procs_seen > 0 || self.repeats_seen > 0 { @@ -742,11 +740,10 @@ impl<'a> Assembler<'a> { ControlType::StartRepeat => { self.repeats_seen += 1; } - ControlType::EndRepeat => { - if self.repeats_seen > 0 { + ControlType::EndRepeat + if self.repeats_seen > 0 => { self.repeats_seen -= 1; } - } _ => {} } @@ -923,7 +920,7 @@ impl<'a> Assembler<'a> { ControlType::StartRepeat => { self.evaluate_repeat_statement(node)?; } - ControlType::StartScope => { + ControlType::StartScope // If this is the start of a .scope statement, then go // inside of its body too if it exists (note that its // existence might not be guaranteed if the parser gave an @@ -931,7 +928,7 @@ impl<'a> Assembler<'a> { // .proc's in its specialized branch, and we don't want to // do it for macros as they will be evaluated on a per call // basis. - if node.right.as_ref().is_some() { + if node.right.as_ref().is_some() => { let scope_name = &node.left.as_ref().unwrap().value; let args = &node.right.as_ref().unwrap().args.as_ref().unwrap(); if args.is_empty() { @@ -946,7 +943,6 @@ impl<'a> Assembler<'a> { self.bundle(args)?; } } - } _ => {} } } |
