Skip to content

Commit cb6cabc

Browse files
committed
[assembler] Formatting fixes ("cargo fmt").
1 parent 52e676f commit cb6cabc

File tree

4 files changed

+59
-46
lines changed

4 files changed

+59
-46
lines changed

assembler/src/asmlib/driver.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ use std::io::{BufReader, BufWriter, Read};
1010
use std::path::{Path, PathBuf};
1111

1212
use chumsky::error::Rich;
13-
use tracing::{event, span, Level};
13+
use tracing::{Level, event, span};
1414

1515
use super::ast::*;
1616
use super::collections::OneOrMore;
1717
use super::directive::Directive;
1818
use super::eval::Evaluate;
1919
use super::eval::HereValue;
20-
use super::eval::{extract_final_equalities, EvaluationContext, RcBlock};
20+
use super::eval::{EvaluationContext, RcBlock, extract_final_equalities};
2121
use super::lexer;
2222
use super::listing::*;
2323
#[cfg(test)]
@@ -35,8 +35,8 @@ use super::span::*;
3535
use super::state::{NumeralMode, State};
3636
use super::symbol::SymbolName;
3737
use super::symtab::{
38-
assign_default_rc_word_tags, ExplicitSymbolTable, FinalSymbolDefinition, FinalSymbolTable,
39-
FinalSymbolType, ImplicitSymbolTable, IndexRegisterAssigner,
38+
ExplicitSymbolTable, FinalSymbolDefinition, FinalSymbolTable, FinalSymbolType,
39+
ImplicitSymbolTable, IndexRegisterAssigner, assign_default_rc_word_tags,
4040
};
4141
use super::types::*;
4242
use base::prelude::{Address, IndexBy, Unsigned18Bit, Unsigned36Bit};
@@ -362,10 +362,10 @@ fn assemble_pass2<'s>(
362362
match block_position.evaluate(&mut ctx) {
363363
Ok(value) => {
364364
if !ctx.index_register_assigner.is_empty() {
365-
return Err(AssemblerFailure::InternalError(
366-
format!(
367-
"While determining the addresses of {0}, we assigned an index register. Block origins should not depend on index registers",
368-
&block_position.block_identifier)));
365+
return Err(AssemblerFailure::InternalError(format!(
366+
"While determining the addresses of {0}, we assigned an index register. Block origins should not depend on index registers",
367+
&block_position.block_identifier
368+
)));
369369
}
370370

371371
let address: Address = subword::right_half(value).into();
@@ -865,8 +865,11 @@ fn test_duplicate_global_tag() {
865865
inner: ProgramError::SyntaxError { msg, span: _ },
866866
..
867867
} => {
868-
assert!(msg
869-
.contains("bad symbol definition for TGX: TGX is defined more than once"));
868+
assert!(
869+
msg.contains(
870+
"bad symbol definition for TGX: TGX is defined more than once"
871+
)
872+
);
870873
}
871874
other => {
872875
panic!("expected a syntax error report, got {other:?}");

assembler/src/asmlib/driver/output.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::io::Write;
22
use std::path::Path;
33

4-
use tracing::{event, span, Level};
4+
use tracing::{Level, event, span};
55

66
use base::prelude::{
7-
join_halves, split_halves, u18, u5, u6, unsplay, Address, Instruction, Opcode, OperandAddress,
8-
Signed18Bit, SymbolicInstruction, Unsigned18Bit, Unsigned36Bit, Unsigned6Bit,
7+
Address, Instruction, Opcode, OperandAddress, Signed18Bit, SymbolicInstruction, Unsigned6Bit,
8+
Unsigned18Bit, Unsigned36Bit, join_halves, split_halves, u5, u6, u18, unsplay,
99
};
1010

1111
use super::super::readerleader::reader_leader;

assembler/src/asmlib/driver/tests.rs

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ use super::super::ast::{
55
InstructionSequence, LiteralValue, TaggedProgramInstruction, UntaggedProgramInstruction,
66
};
77
use super::super::collections::OneOrMore;
8-
use super::super::eval::{make_empty_rc_block_for_test, symbol_name_lookup, EvaluationContext};
8+
use super::super::eval::{EvaluationContext, make_empty_rc_block_for_test, symbol_name_lookup};
99
use super::super::manuscript::{ManuscriptBlock, PunchCommand, SourceFile};
1010
use super::super::memorymap::LocatedBlock;
1111
use super::super::source::Source;
1212
use super::super::span::*;
1313
use super::super::symbol::SymbolName;
1414
use super::super::symtab::IndexRegisterAssigner;
15+
use super::{Binary, BinaryChunk, assemble_pass1};
1516
use super::{assemble_nonempty_valid_input, assemble_source};
16-
use super::{assemble_pass1, Binary, BinaryChunk};
1717
use base::{
1818
charset::Script,
1919
prelude::{
20-
u18, u36, u6, Address, Instruction, Opcode, OperandAddress, SymbolicInstruction,
21-
Unsigned18Bit, Unsigned36Bit, Unsigned5Bit, Unsigned6Bit,
20+
Address, Instruction, Opcode, OperandAddress, SymbolicInstruction, Unsigned5Bit,
21+
Unsigned6Bit, Unsigned18Bit, Unsigned36Bit, u6, u18, u36,
2222
},
2323
};
2424

@@ -136,26 +136,33 @@ fn test_metacommand_dec_changes_default_base() {
136136
"no index register should have been default-assigned"
137137
);
138138

139-
if let [LocatedBlock {
140-
origin: _,
141-
location: _,
142-
sequences,
143-
}] = directive.blocks.values().collect::<Vec<_>>().as_slice()
139+
if let [
140+
LocatedBlock {
141+
origin: _,
142+
location: _,
143+
sequences,
144+
},
145+
] = directive.blocks.values().collect::<Vec<_>>().as_slice()
144146
{
145-
if let [InstructionSequence {
146-
local_symbols: None,
147-
instructions,
148-
}] = sequences.as_slice()
147+
if let [
148+
InstructionSequence {
149+
local_symbols: None,
150+
instructions,
151+
},
152+
] = sequences.as_slice()
149153
{
150-
if let [TaggedProgramInstruction {
151-
span: _,
152-
tags: tags1,
153-
instruction: first_instruction,
154-
}, TaggedProgramInstruction {
155-
span: _,
156-
tags: tags2,
157-
instruction: second_instruction,
158-
}] = instructions.as_slice()
154+
if let [
155+
TaggedProgramInstruction {
156+
span: _,
157+
tags: tags1,
158+
instruction: first_instruction,
159+
},
160+
TaggedProgramInstruction {
161+
span: _,
162+
tags: tags2,
163+
instruction: second_instruction,
164+
},
165+
] = instructions.as_slice()
159166
{
160167
assert!(tags1.is_empty());
161168
assert!(tags2.is_empty());
@@ -1048,13 +1055,16 @@ fn test_symbol_definition_loop_detection() {
10481055
);
10491056
let errors = Vec::from(errors);
10501057
match errors.as_slice() {
1051-
[e1 @ WithLocation {
1052-
location: _,
1053-
inner: ProgramError::SymbolDefinitionLoop { .. },
1054-
}, e2 @ WithLocation {
1055-
location: _,
1056-
inner: ProgramError::SymbolDefinitionLoop { .. },
1057-
}] => {
1058+
[
1059+
e1 @ WithLocation {
1060+
location: _,
1061+
inner: ProgramError::SymbolDefinitionLoop { .. },
1062+
},
1063+
e2 @ WithLocation {
1064+
location: _,
1065+
inner: ProgramError::SymbolDefinitionLoop { .. },
1066+
},
1067+
] => {
10581068
// Then the error messages that result should name
10591069
// both of the problem symbols, indicating the
10601070
// dependency loop for each.

assembler/src/asmlib/eval.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
22
use std::fmt::{self, Debug, Display, Formatter};
33
use std::ops::Shl;
44

5-
use tracing::{event, Level};
5+
use tracing::{Level, event};
66

77
use base::{
88
charset::Script,
@@ -22,9 +22,9 @@ use super::symbol::{ConfigUse, IndexUse, OriginUse, SymbolName};
2222
use super::types::{AssemblerFailure, BlockIdentifier, MachineLimitExceededFailure, ProgramError};
2323
use crate::symbol::SymbolContext;
2424
use crate::symtab::{
25-
record_undefined_symbol_or_return_failure, ExplicitDefinition, ExplicitSymbolTable,
26-
FinalSymbolDefinition, FinalSymbolTable, FinalSymbolType, ImplicitDefinition,
27-
ImplicitSymbolTable, IndexRegisterAssigner, LookupOperation, TagDefinition,
25+
ExplicitDefinition, ExplicitSymbolTable, FinalSymbolDefinition, FinalSymbolTable,
26+
FinalSymbolType, ImplicitDefinition, ImplicitSymbolTable, IndexRegisterAssigner,
27+
LookupOperation, TagDefinition, record_undefined_symbol_or_return_failure,
2828
};
2929

3030
#[derive(Debug, PartialEq, Eq)]

0 commit comments

Comments
 (0)