Skip to content

Commit 79d9e10

Browse files
committed
Fix some clippy complaints (having updated clippy).
1 parent 3c9be21 commit 79d9e10

File tree

3 files changed

+76
-77
lines changed

3 files changed

+76
-77
lines changed

assembler/src/asmlib/driver/tests.rs

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -143,61 +143,58 @@ fn test_metacommand_dec_changes_default_base() {
143143
sequences,
144144
},
145145
] = directive.blocks.values().collect::<Vec<_>>().as_slice()
146-
{
147-
if let [
146+
&& let [
148147
InstructionSequence {
149148
local_symbols: None,
150149
instructions,
151150
},
152151
] = sequences.as_slice()
153-
{
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()
166-
{
167-
assert!(tags1.is_empty());
168-
assert!(tags2.is_empty());
169-
170-
let first_fragment = first_instruction.fragments.first();
171-
let second_fragment = second_instruction.fragments.first();
172-
173-
assert_eq!(first_fragment.leading_commas, None);
174-
assert_eq!(first_fragment.trailing_commas, None);
175-
assert_eq!(second_fragment.leading_commas, None);
176-
assert_eq!(second_fragment.trailing_commas, None);
177-
178-
// Then we should see that the first value is assembled as 10 octal...
179-
assert_eq!(
180-
&first_fragment.fragment,
181-
&InstructionFragment::from((
182-
Span::from(0..2usize),
183-
Script::Normal,
184-
Unsigned36Bit::from(0o10_u32),
185-
)),
186-
);
187-
// ... and that the first value is assembled as 12
188-
// octal (10 decimal).
189-
assert_eq!(
190-
&second_fragment.fragment,
191-
&InstructionFragment::from((
192-
span(17..19),
193-
Script::Normal,
194-
Unsigned36Bit::from(0o12_u32),
195-
)),
196-
);
197-
return;
198-
}
199-
}
152+
&& let [
153+
TaggedProgramInstruction {
154+
span: _,
155+
tags: tags1,
156+
instruction: first_instruction,
157+
},
158+
TaggedProgramInstruction {
159+
span: _,
160+
tags: tags2,
161+
instruction: second_instruction,
162+
},
163+
] = instructions.as_slice()
164+
{
165+
assert!(tags1.is_empty());
166+
assert!(tags2.is_empty());
167+
168+
let first_fragment = first_instruction.fragments.first();
169+
let second_fragment = second_instruction.fragments.first();
170+
171+
assert_eq!(first_fragment.leading_commas, None);
172+
assert_eq!(first_fragment.trailing_commas, None);
173+
assert_eq!(second_fragment.leading_commas, None);
174+
assert_eq!(second_fragment.trailing_commas, None);
175+
176+
// Then we should see that the first value is assembled as 10 octal...
177+
assert_eq!(
178+
&first_fragment.fragment,
179+
&InstructionFragment::from((
180+
Span::from(0..2usize),
181+
Script::Normal,
182+
Unsigned36Bit::from(0o10_u32),
183+
)),
184+
);
185+
// ... and that the first value is assembled as 12
186+
// octal (10 decimal).
187+
assert_eq!(
188+
&second_fragment.fragment,
189+
&InstructionFragment::from((
190+
span(17..19),
191+
Script::Normal,
192+
Unsigned36Bit::from(0o12_u32),
193+
)),
194+
);
195+
return;
200196
}
197+
201198
panic!(
202199
"expected two items with value 10 octal and 12 octal, got {:?}",
203200
&directive,

assembler/src/asmlib/glyph.rs

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -163,37 +163,35 @@ impl Glyph {
163163
#[test]
164164
fn test_subscript_char_agreement() {
165165
for g in ALL_GLYPHS {
166-
if let Some(ch) = g.normal {
167-
if let Some(glyph_sub_ch) = g.subscript {
168-
if let Ok(charset_sub_ch) = subscript_char(ch) {
169-
assert_eq!(
170-
glyph_sub_ch,
171-
charset_sub_ch,
172-
"glyph {g:?} maps {ch} to {glyph_sub_ch} ({}) but subscript_char maps it to {charset_sub_ch} ({})",
173-
glyph_sub_ch.escape_unicode(),
174-
charset_sub_ch.escape_unicode(),
175-
);
176-
}
177-
}
166+
if let Some(ch) = g.normal
167+
&& let Some(glyph_sub_ch) = g.subscript
168+
&& let Ok(charset_sub_ch) = subscript_char(ch)
169+
{
170+
assert_eq!(
171+
glyph_sub_ch,
172+
charset_sub_ch,
173+
"glyph {g:?} maps {ch} to {glyph_sub_ch} ({}) but subscript_char maps it to {charset_sub_ch} ({})",
174+
glyph_sub_ch.escape_unicode(),
175+
charset_sub_ch.escape_unicode(),
176+
);
178177
}
179178
}
180179
}
181180

182181
#[test]
183182
fn test_superscript_char_agreement() {
184183
for g in ALL_GLYPHS {
185-
if let Some(ch) = g.normal {
186-
if let Some(glyph_sup_ch) = g.superscript {
187-
if let Ok(charset_sup_ch) = superscript_char(ch) {
188-
assert_eq!(
189-
glyph_sup_ch,
190-
charset_sup_ch,
191-
"glyph {g:?} maps {ch} to {glyph_sup_ch} ({}) but superscript_char maps it to {charset_sup_ch} ({})",
192-
glyph_sup_ch.escape_unicode(),
193-
charset_sup_ch.escape_unicode(),
194-
);
195-
}
196-
}
184+
if let Some(ch) = g.normal
185+
&& let Some(glyph_sup_ch) = g.superscript
186+
&& let Ok(charset_sup_ch) = superscript_char(ch)
187+
{
188+
assert_eq!(
189+
glyph_sup_ch,
190+
charset_sup_ch,
191+
"glyph {g:?} maps {ch} to {glyph_sup_ch} ({}) but superscript_char maps it to {charset_sup_ch} ({})",
192+
glyph_sup_ch.escape_unicode(),
193+
charset_sup_ch.escape_unicode(),
194+
);
197195
}
198196
}
199197
}

assembler/src/asmlib/parser/tests.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ fn test_assignment_origin() {
12491249

12501250
#[test]
12511251
fn test_symbolic_origin() {
1252-
const INPUT: &str = concat!("BEGIN|2\n",);
1252+
const INPUT: &str = "BEGIN|2\n";
12531253
let tree = parse_successfully_with(INPUT, source_file(), no_state_setup);
12541254
assert_eq!(
12551255
tree,
@@ -1314,7 +1314,9 @@ fn test_metacommand_octal() {
13141314
);
13151315
}
13161316

1317-
fn parse_normal_arithmetic_expression(input: &str) -> Result<ArithmeticExpression, ParseErrors> {
1317+
fn parse_normal_arithmetic_expression(
1318+
input: &str,
1319+
) -> Result<ArithmeticExpression, ParseErrors<'_>> {
13181320
let g = grammar();
13191321
parse_with(
13201322
input,
@@ -1325,7 +1327,7 @@ fn parse_normal_arithmetic_expression(input: &str) -> Result<ArithmeticExpressio
13251327

13261328
fn parse_superscript_arithmetic_expression(
13271329
input: &str,
1328-
) -> Result<ArithmeticExpression, ParseErrors> {
1330+
) -> Result<ArithmeticExpression, ParseErrors<'_>> {
13291331
let g = grammar();
13301332
parse_with(
13311333
input,
@@ -1334,7 +1336,9 @@ fn parse_superscript_arithmetic_expression(
13341336
)
13351337
}
13361338

1337-
fn parse_subscript_arithmetic_expression(input: &str) -> Result<ArithmeticExpression, ParseErrors> {
1339+
fn parse_subscript_arithmetic_expression(
1340+
input: &str,
1341+
) -> Result<ArithmeticExpression, ParseErrors<'_>> {
13381342
let g = grammar();
13391343
parse_with(
13401344
input,

0 commit comments

Comments
 (0)