Skip to content

Commit a473a14

Browse files
committed
Format
1 parent 610bc00 commit a473a14

13 files changed

Lines changed: 81 additions & 66 deletions

File tree

crates/engine_bibtex/src/auxi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
print_confusion, print_overflow, AuxTy,
1414
},
1515
peekable::PeekableInput,
16-
pool::{StringPool, StrNumber},
16+
pool::{StrNumber, StringPool},
1717
scan::Scan,
1818
Bibtex, BibtexError, File, GlobalItems, StrIlk,
1919
};

crates/engine_bibtex/src/bibs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use crate::{
99
print_confusion,
1010
},
1111
peekable::input_ln,
12-
pool::StringPool,
12+
pool::{StrNumber, StringPool},
1313
scan::{scan_and_store_the_field_value_and_eat_white, scan_identifier, Scan, ScanRes},
1414
BibNumber, Bibtex, BibtexError, File, GlobalItems, HashPointer, StrIlk,
1515
};
16-
use crate::pool::StrNumber;
1716

1817
#[derive(Copy, Clone, Debug, PartialEq)]
1918
pub(crate) enum BibCommand {

crates/engine_bibtex/src/bst.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
hash_cite_confusion, log_pr_bib_name, nonexistent_cross_reference_error, print_a_token,
1313
print_bib_name, print_confusion, print_fn_class, print_missing_entry,
1414
},
15-
pool::{StringPool, StrNumber},
15+
pool::{StrNumber, StringPool},
1616
scan::{eat_bst_white_space, scan_fn_def, scan_identifier, Scan, ScanRes},
1717
Bibtex, BibtexError, GlobalItems, HashPointer, StrIlk,
1818
};
@@ -369,7 +369,9 @@ fn bst_iterate_command(
369369

370370
let mut sort_cite_ptr = 0;
371371
while sort_cite_ptr < globals.cites.num_cites() {
372-
globals.cites.set_ptr(globals.cites.info(sort_cite_ptr).to_raw_dangerous());
372+
globals
373+
.cites
374+
.set_ptr(globals.cites.info(sort_cite_ptr).to_raw_dangerous());
373375
execute_fn(ctx, globals, fn_loc)?;
374376
check_command_execution(ctx, globals.pool, globals.hash, globals.cites)?;
375377
sort_cite_ptr += 1;
@@ -400,9 +402,12 @@ fn bst_macro_command(
400402
let bst_fn = &mut globals.buffers.buffer_mut(BufTy::Base)[range];
401403
bst_fn.make_ascii_lowercase();
402404

403-
let res = globals
404-
.hash
405-
.lookup_str_insert(ctx, globals.pool, bst_fn, HashExtra::Macro(StrNumber::invalid()))?;
405+
let res = globals.hash.lookup_str_insert(
406+
ctx,
407+
globals.pool,
408+
bst_fn,
409+
HashExtra::Macro(StrNumber::invalid()),
410+
)?;
406411
if res.exists {
407412
print_a_token(ctx, globals.buffers);
408413
ctx.write_logs(" is already defined as a macro");
@@ -651,7 +656,8 @@ fn bst_read_command(
651656
}
652657
if !ctx.all_entries
653658
&& cite_parent_ptr >= globals.cites.old_num_cites()
654-
&& globals.cites.info(cite_parent_ptr).to_raw_dangerous() < ctx.config.min_crossrefs as usize
659+
&& globals.cites.info(cite_parent_ptr).to_raw_dangerous()
660+
< ctx.config.min_crossrefs as usize
655661
{
656662
globals.other.set_field(field_ptr, StrNumber::invalid());
657663
}
@@ -728,7 +734,9 @@ fn bst_read_command(
728734
globals.entries.init_entries(globals.cites);
729735

730736
for idx in 0..globals.cites.num_cites() {
731-
globals.cites.set_info(idx, StrNumber::from_raw_dangerous(idx));
737+
globals
738+
.cites
739+
.set_info(idx, StrNumber::from_raw_dangerous(idx));
732740
}
733741
globals.cites.set_ptr(globals.cites.num_cites());
734742

@@ -786,7 +794,9 @@ fn bst_reverse_command(
786794
ctx.mess_with_entries = true;
787795

788796
for idx in (0..globals.cites.num_cites()).rev() {
789-
globals.cites.set_ptr(globals.cites.info(idx).to_raw_dangerous());
797+
globals
798+
.cites
799+
.set_ptr(globals.cites.info(idx).to_raw_dangerous());
790800
execute_fn(ctx, globals, fn_loc)?;
791801
check_command_execution(ctx, globals.pool, globals.hash, globals.cites)?;
792802
}

crates/engine_bibtex/src/cite.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{
22
entries::EntryData,
33
hash::{HashData, HashExtra},
44
other::OtherData,
5-
pool::{StringPool, StrNumber},
5+
pool::{StrNumber, StringPool},
66
CiteNumber, FindCiteLocs, HashPointer, StrIlk,
77
};
88
use std::{cmp::Ordering, ops::IndexMut};
@@ -38,8 +38,10 @@ impl CiteInfo {
3838
}
3939

4040
pub fn grow(&mut self) {
41-
self.cite_list.resize(self.cite_list.len() + MAX_CITES, StrNumber::invalid());
42-
self.cite_info.resize(self.cite_info.len() + MAX_CITES, StrNumber::invalid());
41+
self.cite_list
42+
.resize(self.cite_list.len() + MAX_CITES, StrNumber::invalid());
43+
self.cite_info
44+
.resize(self.cite_info.len() + MAX_CITES, StrNumber::invalid());
4345
self.type_list.resize(self.type_list.len() + MAX_CITES, 0);
4446
self.entry_exists
4547
.resize(self.entry_exists.len() + MAX_CITES, false);
@@ -125,7 +127,8 @@ impl CiteInfo {
125127
where
126128
Vec<StrNumber>: IndexMut<I, Output = [StrNumber]>,
127129
{
128-
self.cite_info[r].sort_by(|a, b| less_than(entries, a.to_raw_dangerous(), b.to_raw_dangerous()))
130+
self.cite_info[r]
131+
.sort_by(|a, b| less_than(entries, a.to_raw_dangerous(), b.to_raw_dangerous()))
129132
}
130133
}
131134

crates/engine_bibtex/src/exec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ use crate::{
1212
bst_cant_mess_with_entries_print, output_bbl_line, print_a_pool_str, print_confusion,
1313
print_fn_class,
1414
},
15-
pool::{StringPool, StrNumber},
15+
pool::{Checkpoint, StrNumber, StringPool, MAX_PRINT_LINE, MIN_PRINT_LINE},
1616
scan::{
1717
check_brace_level, decr_brace_level, enough_text_chars, name_scan_for_and,
1818
von_name_ends_and_last_name_starts_stuff, von_token_found, QUOTE_NEXT_FN,
1919
},
2020
ASCIICode, Bibtex, BibtexError, BufPointer, GlobalItems, HashPointer, StrIlk,
2121
};
2222
use std::ops::{Deref, DerefMut, Index};
23-
use crate::pool::{Checkpoint, MAX_PRINT_LINE, MIN_PRINT_LINE};
2423

2524
#[derive(Copy, Clone, Debug, PartialEq)]
2625
pub(crate) enum ControlSeq {

crates/engine_bibtex/src/global.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{ASCIICode, pool::StrNumber};
1+
use crate::{pool::StrNumber, ASCIICode};
22

33
const MAX_GLOB_STRS: usize = 10;
44
pub(crate) const GLOB_STR_SIZE: usize = 20000;
@@ -21,8 +21,10 @@ impl GlobalData {
2121
}
2222

2323
pub fn grow(&mut self) {
24-
self.glb_bib_str_ptr
25-
.resize(self.glb_bib_str_ptr.len() + MAX_GLOB_STRS, StrNumber::invalid());
24+
self.glb_bib_str_ptr.resize(
25+
self.glb_bib_str_ptr.len() + MAX_GLOB_STRS,
26+
StrNumber::invalid(),
27+
);
2628
self.global_strs.resize(
2729
self.global_strs.len() + (GLOB_STR_SIZE + 1) * MAX_GLOB_STRS,
2830
0,

crates/engine_bibtex/src/hash.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
use crate::{auxi::AuxCommand, bibs::BibCommand, bst::BstCommand, exec::ControlSeq, pool, pool::StrNumber, ASCIICode, Bibtex, BibtexError, CiteNumber, FnDefLoc, HashPointer, LookupRes, StrIlk};
2-
use crate::log::print_overflow;
3-
use crate::pool::StringPool;
1+
use crate::{
2+
auxi::AuxCommand,
3+
bibs::BibCommand,
4+
bst::BstCommand,
5+
exec::ControlSeq,
6+
log::print_overflow,
7+
pool,
8+
pool::{StrNumber, StringPool},
9+
ASCIICode, Bibtex, BibtexError, CiteNumber, FnDefLoc, HashPointer, LookupRes, StrIlk,
10+
};
411

512
pub(crate) const HASH_BASE: usize = 1;
613
pub(crate) const HASH_SIZE: usize = if pool::MAX_STRINGS > 5000 {
@@ -236,7 +243,8 @@ impl HashData {
236243
let exists = loop {
237244
let existing = self.text(p);
238245

239-
if !existing.is_invalid() && pool.get_str(existing) == str && self.node(p).kind() == ilk {
246+
if !existing.is_invalid() && pool.get_str(existing) == str && self.node(p).kind() == ilk
247+
{
240248
break true;
241249
}
242250

@@ -332,9 +340,7 @@ impl HashData {
332340
#[cfg(test)]
333341
mod tests {
334342
use super::*;
335-
use crate::{Bibtex, BibtexConfig};
336-
use crate::pool::StringPool;
337-
use crate::test_utils::with_cbs;
343+
use crate::{pool::StringPool, test_utils::with_cbs, Bibtex, BibtexConfig};
338344

339345
#[test]
340346
fn test_lookup_str() {
@@ -369,10 +375,7 @@ mod tests {
369375

370376
let res4 = hash.lookup_str(&pool, b"a bad string", StrIlk::Text);
371377
assert!(!res4.exists);
372-
assert_eq!(
373-
pool.try_get_str(hash.text(res4.loc)),
374-
None,
375-
);
378+
assert_eq!(pool.try_get_str(hash.text(res4.loc)), None,);
376379
})
377380
}
378381
}

crates/engine_bibtex/src/lib.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,25 @@
1818
//! [`tectonic`]: https://docs.rs/tectonic/
1919
2020
use crate::{
21-
auxi::{get_aux_command_and_process, last_check_for_aux_errors, pop_the_aux_stack, AuxData},
22-
bibs::BibData,
23-
bst::get_bst_command_and_process,
21+
auxi::{
22+
get_aux_command_and_process, last_check_for_aux_errors, pop_the_aux_stack, AuxCommand,
23+
AuxData,
24+
},
25+
bibs::{BibCommand, BibData},
26+
bst::{get_bst_command_and_process, BstCommand},
2427
buffer::{BufTy, GlobalBuffer},
2528
cite::CiteInfo,
26-
entries::EntryData,
27-
exec::ExecCtx,
28-
global::GlobalData,
29-
hash::{HashData, HashExtra},
29+
entries::{EntryData, ENT_STR_SIZE},
30+
exec::{ControlSeq, ExecCtx},
31+
global::{GlobalData, GLOB_STR_SIZE},
32+
hash::{BstBuiltin, BstFn, HashData, HashExtra},
3033
log::{
3134
bib_close_log, log_pr_aux_name, print_aux_name, print_confusion, sam_wrong_file_name_print,
3235
AsBytes,
3336
},
3437
other::OtherData,
3538
peekable::{input_ln, PeekableInput},
36-
pool::{StringPool, StrNumber},
39+
pool::{StrNumber, StringPool},
3740
scan::eat_bst_white_space,
3841
};
3942
use std::{
@@ -42,13 +45,6 @@ use std::{
4245
};
4346
use tectonic_bridge_core::{CoreBridgeLauncher, CoreBridgeState, FileFormat, OutputId};
4447
use tectonic_errors::prelude::*;
45-
use crate::auxi::AuxCommand;
46-
use crate::bibs::BibCommand;
47-
use crate::bst::BstCommand;
48-
use crate::entries::ENT_STR_SIZE;
49-
use crate::exec::ControlSeq;
50-
use crate::global::GLOB_STR_SIZE;
51-
use crate::hash::{BstBuiltin, BstFn};
5248

5349
pub(crate) mod auxi;
5450
pub(crate) mod bibs;

crates/engine_bibtex/src/log.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ use crate::{
88
hash::{BstFn, HashData, HashExtra},
99
other::OtherData,
1010
peekable::input_ln,
11-
pool::StringPool,
11+
pool::{StrNumber, StringPool},
1212
scan::{Scan, ScanRes},
1313
ASCIICode, Bibtex, BibtexError, CiteNumber, FieldLoc, HashPointer,
1414
};
1515
use std::{ffi::CStr, io::Write, slice};
1616
use tectonic_io_base::OutputHandle;
17-
use crate::pool::StrNumber;
1817

1918
pub trait AsBytes {
2019
fn as_bytes(&self) -> &[u8];

crates/engine_bibtex/src/other.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{FieldLoc, HashPointer, pool::StrNumber};
1+
use crate::{pool::StrNumber, FieldLoc, HashPointer};
22

33
const MAX_FIELDS: usize = 17250;
44

0 commit comments

Comments
 (0)