aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/nasm/src/main.rs2
-rw-r--r--lib/header/src/lib.rs10
-rw-r--r--lib/xixanta/src/assembler.rs20
-rw-r--r--lib/xixanta/src/cfg.rs5
4 files changed, 15 insertions, 22 deletions
diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs
index 007b897..63d7e9d 100644
--- a/crates/nasm/src/main.rs
+++ b/crates/nasm/src/main.rs
@@ -216,7 +216,7 @@ fn save_memory_stats(source: &SourceInfo, memory: &mut MemoryResult, has_working
};
let ranges = &mut memory.memory_ranges;
- ranges.sort_by(|a, b| a.range.start.cmp(&b.range.start));
+ ranges.sort_by_key(|a| a.range.start);
for mr in ranges {
if mr.range.start + 1 == mr.range.end {
diff --git a/lib/header/src/lib.rs b/lib/header/src/lib.rs
index 7a858ea..bd1edaa 100644
--- a/lib/header/src/lib.rs
+++ b/lib/header/src/lib.rs
@@ -285,25 +285,23 @@ fn parse_nametable(byte: Option<&u8>, mapper: &Mapper) -> NameTableArrangement {
| Mapper::Mmc3Nec
| Mapper::Mmc3Sharp
| Mapper::Mmc3T9552
- | Mapper::Mmc3c => {
+ | Mapper::Mmc3c
// MMC3 chips can mean a 4-screen nametable arrangement if
// the "alternative nametable layout" bit is set.
- if (b & 0x08) == 0x08 {
+ if (b & 0x08) == 0x08 => {
return NameTableArrangement::FourScreen;
}
- }
- Mapper::Unrom512 => {
+ Mapper::Unrom512
// In UNROM 512 chips, if the "alternative nametable layout"
// bit is set, then it depends on the "nametable
// arrangement" bit to decide whether it's a 1-screen or
// 4-screen layout.
- if (b & 0x08) == 0x08 {
+ if (b & 0x08) == 0x08 => {
if b & 0x1 == 0 {
return NameTableArrangement::OneScreen;
}
return NameTableArrangement::FourScreen;
}
- }
_ => {}
}
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)?;
}
}
- }
_ => {}
}
}
diff --git a/lib/xixanta/src/cfg.rs b/lib/xixanta/src/cfg.rs
index 66d2a28..57781f2 100644
--- a/lib/xixanta/src/cfg.rs
+++ b/lib/xixanta/src/cfg.rs
@@ -104,11 +104,10 @@ fn fetch_memory_definition(line: &str, line_num: usize) -> Result<RawMapping, St
match key.trim() {
"file" => res.ignore = val != "%O",
- "fill" => {
- if res.fill.is_none() {
+ "fill"
+ if res.fill.is_none() => {
res.fill = Some(String::from(""));
}
- }
"fillval" => res.fill = Some(val.to_string()),
"start" => res.start = val.to_string(),
"size" => res.size = val.to_string(),