Skip to content

Commit

Permalink
Clean up some clippy annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftSpider committed Mar 7, 2024
1 parent 42cffad commit bec9bbf
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 270 deletions.
88 changes: 35 additions & 53 deletions crates/engine_bibtex/src/bibs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) fn compress_bib_white(
buffers: &mut GlobalBuffer,
pool: &StringPool,
bibs: &mut BibData,
at_bib_command: bool,
bib_command: Option<BibCommand>,
) -> Result<bool, BibtexError> {
if buffers.offset(BufTy::Ex, 1) == buffers.len() {
ctx.write_log_file("Field filled up at ' ', reallocating.\n");

Check warning on line 99 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L99

Added line #L99 was not covered by tests
Expand All @@ -110,7 +110,7 @@ pub(crate) fn compress_bib_white(
let res = !input_ln(ctx.engine, &mut bibs.top_file_mut().file, buffers);

Check warning on line 110 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L110

Added line #L110 was not covered by tests

if res {
return eat_bib_print(ctx, buffers, pool, bibs, at_bib_command).map(|_| false);
return eat_bib_print(ctx, buffers, pool, bibs, bib_command).map(|_| false);

Check warning on line 113 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L113

Added line #L113 was not covered by tests
}

bibs.top_file_mut().line += 1;

Check warning on line 116 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L116

Added line #L116 was not covered by tests
Expand All @@ -131,7 +131,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
cur_macro_loc: &mut HashPointer,
field_name_loc: &mut HashPointer,
) -> Result<(), BibtexError> {
let mut at_bib_command = false;
let mut bib_command = None;

let mut init = globals.buffers.init(BufTy::Base);
while !Scan::new().chars(&[b'@']).scan_till(globals.buffers, init) {
Expand Down Expand Up @@ -164,7 +164,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 166 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L162-L166

Added lines #L162 - L166 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 168 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L168

Added line #L168 was not covered by tests
return Ok(());
}
Expand All @@ -180,7 +180,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 182 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L176-L182

Added lines #L176 - L182 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 184 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L184

Added line #L184 was not covered by tests
return Ok(());
}
Expand All @@ -201,7 +201,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
panic!("BibCommand lookup didn't have BibCommand extra");

Check warning on line 201 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L201

Added line #L201 was not covered by tests
};

at_bib_command = true;
bib_command = Some(cmd);
match cmd {
BibCommand::Comment => (),
BibCommand::Preamble => {
Expand All @@ -211,7 +211,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 213 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L209-L213

Added lines #L209 - L213 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 215 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L215

Added line #L215 was not covered by tests
return Ok(());
}
Expand All @@ -227,7 +227,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.bibs,
b'{',
b'(',
at_bib_command,
bib_command,
)?;
return Ok(());
}
Expand All @@ -245,22 +245,16 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 247 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L243-L247

Added lines #L243 - L247 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 249 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L249

Added line #L249 was not covered by tests
return Ok(());
}

if !scan_and_store_the_field_value_and_eat_white(
ctx,
globals.buffers,
globals.hash,
globals.pool,
globals.bibs,
globals.other,
globals.cites,
globals,
true,
at_bib_command,
cmd,
bib_command,
Some(&mut lc_cite_loc),
*cur_macro_loc,
right_outer_delim,
Expand All @@ -279,7 +273,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 275 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L271-L275

Added lines #L271 - L275 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 277 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L277

Added line #L277 was not covered by tests
return Ok(());
}
Expand All @@ -296,7 +290,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 292 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L287-L292

Added lines #L287 - L292 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 294 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L294

Added line #L294 was not covered by tests
return Ok(());
}
Expand All @@ -312,7 +306,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.bibs,
b'{',
b'(',
at_bib_command,
bib_command,
)?;
return Ok(());
}
Expand All @@ -330,7 +324,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 326 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L321-L326

Added lines #L321 - L326 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 328 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L328

Added line #L328 was not covered by tests
return Ok(());
}
Expand All @@ -346,7 +340,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 342 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L336-L342

Added lines #L336 - L342 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 344 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L344

Added line #L344 was not covered by tests
return Ok(());
}
Expand Down Expand Up @@ -374,7 +368,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 370 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L365-L370

Added lines #L365 - L370 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 372 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L372

Added line #L372 was not covered by tests
return Ok(());
}
Expand All @@ -385,7 +379,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,
at_bib_command,
bib_command,
)?;
return Ok(());
}
Expand All @@ -402,22 +396,16 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 398 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L393-L398

Added lines #L393 - L398 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 400 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L400

Added line #L400 was not covered by tests
return Ok(());
}

if !scan_and_store_the_field_value_and_eat_white(
ctx,
globals.buffers,
globals.hash,
globals.pool,
globals.bibs,
globals.other,
globals.cites,
globals,

Check warning on line 406 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L406

Added line #L406 was not covered by tests
true,
at_bib_command,
cmd,
bib_command,
Some(&mut lc_cite_loc),
*cur_macro_loc,
right_outer_delim,
Expand All @@ -436,7 +424,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 426 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L422-L426

Added lines #L422 - L426 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 428 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L428

Added line #L428 was not covered by tests
return Ok(());
}
Expand Down Expand Up @@ -470,7 +458,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 460 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L456-L460

Added lines #L456 - L460 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 462 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L462

Added line #L462 was not covered by tests
return Ok(());
}
Expand All @@ -486,7 +474,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.bibs,
b'{',
b'(',
at_bib_command,
bib_command,
)?;
return Ok(());
}
Expand All @@ -502,7 +490,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 492 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L488-L492

Added lines #L488 - L492 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 494 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L494

Added line #L494 was not covered by tests
return Ok(());
}
Expand Down Expand Up @@ -618,7 +606,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,
at_bib_command,
bib_command,

Check warning on line 609 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L609

Added line #L609 was not covered by tests
));
}
None
Expand Down Expand Up @@ -695,7 +683,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 685 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L681-L685

Added lines #L681 - L685 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 687 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L687

Added line #L687 was not covered by tests
return Ok(());
}
Expand All @@ -709,7 +697,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.bibs,
b',',
right_outer_delim,
at_bib_command,
bib_command,
)?;
return Ok(());
}
Expand All @@ -724,7 +712,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 714 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L710-L714

Added lines #L710 - L714 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 716 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L716

Added line #L716 was not covered by tests
return Ok(());
}
Expand All @@ -744,7 +732,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 734 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L728-L734

Added lines #L728 - L734 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 736 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L736

Added line #L736 was not covered by tests
return Ok(());
}
Expand Down Expand Up @@ -774,7 +762,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 764 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L760-L764

Added lines #L760 - L764 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 766 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L766

Added line #L766 was not covered by tests
return Ok(());
}
Expand All @@ -785,7 +773,7 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 775 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L771-L775

Added lines #L771 - L775 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 777 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L777

Added line #L777 was not covered by tests
return Ok(());
}
Expand All @@ -800,22 +788,16 @@ pub(crate) fn get_bib_command_or_entry_and_process(
globals.buffers,
globals.pool,
globals.bibs,

Check warning on line 790 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L787-L790

Added lines #L787 - L790 were not covered by tests
at_bib_command,
bib_command,
)?;

Check warning on line 792 in crates/engine_bibtex/src/bibs.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/bibs.rs#L792

Added line #L792 was not covered by tests
return Ok(());
}

if !scan_and_store_the_field_value_and_eat_white(
ctx,
globals.buffers,
globals.hash,
globals.pool,
globals.bibs,
globals.other,
globals.cites,
globals,
store_field,
at_bib_command,
BibCommand::Comment,
bib_command,
None,
*cur_macro_loc,
right_outer_delim,
Expand Down
10 changes: 1 addition & 9 deletions crates/engine_bibtex/src/bst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,7 @@ fn bst_function_command(
globals
.buffers
.set_offset(BufTy::Base, 2, globals.buffers.offset(BufTy::Base, 2) + 1);
scan_fn_def(
ctx,
globals.buffers,
globals.hash,
globals.pool,
globals.other,
res.loc,
res.loc,
)?;
scan_fn_def(ctx, globals, res.loc, res.loc)?;
Ok(())
}

Expand Down
2 changes: 0 additions & 2 deletions crates/engine_bibtex/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,6 @@ fn interp_gets(
}
};

// TODO: Merge into match below

match &hash.node(f1).extra {
HashExtra::BstFn(BstFn::IntEntry(_) | BstFn::StrEntry(_)) if !ctx.mess_with_entries => {
bst_cant_mess_with_entries_print(ctx, pool, cites)?;

Check warning on line 926 in crates/engine_bibtex/src/exec.rs

View check run for this annotation

Codecov / codecov/patch

crates/engine_bibtex/src/exec.rs#L925-L926

Added lines #L925 - L926 were not covered by tests
Expand Down
Loading

0 comments on commit bec9bbf

Please sign in to comment.