Skip to content

Commit 09bfedc

Browse files
authored
Merge pull request #868 from pkgw/issue-844
Fix issue 844
2 parents e1c9566 + b2afb1d commit 09bfedc

12 files changed

Lines changed: 69 additions & 35 deletions

File tree

Cargo.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/engine_spx2html/src/font.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,9 @@ fn load_math_variants(
512512
let c = map.get(glyph).unwrap().get_char();
513513

514514
if let Some(vvars) = maybe_vcov
515-
.map(|c| c.get(*glyph))
516-
.flatten()
517-
.map(|i| variants.vert_glyph_construction(i))
518-
.flatten()
519-
.map(|c| c.variants())
520-
.flatten()
515+
.and_then(|c| c.get(*glyph))
516+
.and_then(|i| variants.vert_glyph_construction(i))
517+
.and_then(|c| c.variants())
521518
{
522519
for (idx, vinfo) in vvars.iter().enumerate() {
523520
map.insert(
@@ -528,12 +525,9 @@ fn load_math_variants(
528525
}
529526

530527
if let Some(hvars) = maybe_hcov
531-
.map(|c| c.get(*glyph))
532-
.flatten()
533-
.map(|i| variants.horiz_glyph_construction(i))
534-
.flatten()
535-
.map(|c| c.variants())
536-
.flatten()
528+
.and_then(|c| c.get(*glyph))
529+
.and_then(|i| variants.horiz_glyph_construction(i))
530+
.and_then(|c| c.variants())
537531
{
538532
for (idx, vinfo) in hvars.iter().enumerate() {
539533
map.insert(

crates/geturl/src/reqwest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ impl GetUrlBackend for ReqwestBackend {
4242
let parsed = Url::parse(url)?;
4343
let original_filename = parsed
4444
.path_segments()
45-
.map(|s| s.last())
46-
.flatten()
45+
.and_then(|s| s.last())
4746
.unwrap_or(".") // if the filename is this, the `contains('.')` will already match
4847
.to_owned();
4948

crates/xetex_format/src/dimenpars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub fn emit_c_header_primitives<W: Write>(pars: &[DimenPar], mut stream: W) -> R
149149
writeln!(
150150
stream,
151151
" {{ \"{}\", ASSIGN_DIMEN, DIMEN_BASE + DIMEN_PAR__{}, xf_prim_init_none }}, \\",
152-
par.name.replace("_", ""),
152+
par.name.replace('_', ""),
153153
par.name.to_lowercase(),
154154
)?;
155155
}

crates/xetex_format/src/enums/dynamic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<T: Copy + std::fmt::Debug> DynamicEnumResolver<T> {
117117

118118
if let Some(v) = item.absval {
119119
ensure!(
120-
!values.insert(cur_val, v).is_some(),
120+
values.insert(cur_val, v).is_none(),
121121
"duplicated dynamic enum variant value"
122122
);
123123
}

crates/xetex_format/src/etexpenalties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn emit_c_header_primitives<W: Write>(pars: &[EtexPenaltiesPar], mut stream:
7777
writeln!(
7878
stream,
7979
" {{ \"{}\", SET_SHAPE, ETEX_PEN_BASE + ETEX_PENALTIES_PAR__{}, xf_prim_init_none }}, \\",
80-
par.name.replace("_", ""),
80+
par.name.replace('_', ""),
8181
par.name.to_lowercase(),
8282
)?;
8383
}

crates/xetex_format/src/gluepars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub fn emit_c_header_primitives<W: Write>(pars: &[GluePar], mut stream: W) -> Re
170170
writeln!(
171171
stream,
172172
" {{ \"{}\", {}, GLUE_BASE + GLUE_PAR__{}, xf_prim_init_none }}, \\",
173-
par.name.replace("_", ""),
173+
par.name.replace('_', ""),
174174
cmd,
175175
par.name.to_lowercase(),
176176
)?;

crates/xetex_format/src/intpars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ pub fn emit_c_header_primitives<W: Write>(pars: &[IntPar], mut stream: W) -> Res
505505
writeln!(
506506
stream,
507507
" {{ \"{}\", ASSIGN_INT, INT_BASE + INT_PAR__{}, xf_prim_init_none }}, \\",
508-
prim_name.replace("_", ""),
508+
prim_name.replace('_', ""),
509509
par.name.to_lowercase(),
510510
)?;
511511
}

crates/xetex_format/src/locals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub fn emit_c_header_primitives<W: Write>(pars: &[LocalPar], mut stream: W) -> R
166166
writeln!(
167167
stream,
168168
" {{ \"{}\", {}, LOCAL_BASE + LOCAL__{}, xf_prim_init_none }}, \\",
169-
prim_name.replace("_", ""),
169+
prim_name.replace('_', ""),
170170
cmd,
171171
par.name.to_lowercase(),
172172
)?;

src/driver.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,19 @@ impl BridgeState {
338338
));
339339
}
340340

341-
// We could try to be clever and symlink when the input file has
342-
// an abspath or something, but ... meh.
343341
let mut ih = self.input_open_name(name, status).must_exist()?;
344342

343+
// If the input path is absolute, we don't need to create a
344+
// version in the tempdir, and in fact the current
345+
// implementation below will blow away the input file. However,
346+
// we do want to try to open the input so that it gets
347+
// registered with the I/O tracking system.
348+
349+
let path = Path::new(name);
350+
if path.is_absolute() {
351+
continue;
352+
}
353+
345354
let tool_path = tempdir.path().join(name);
346355
let tool_parent = tool_path.parent().unwrap();
347356

@@ -1682,7 +1691,7 @@ impl ProcessingSession {
16821691
// PathBuf.file_stem() doesn't do what we want since it only strips
16831692
// one extension. As of 1.17, the compiler needs a type annotation for
16841693
// some reason, which is why we use the `r` variable.
1685-
let r: Result<&str> = self.format_name.splitn(2, '.').next().ok_or_else(|| {
1694+
let r: Result<&str> = self.format_name.split('.').next().ok_or_else(|| {
16861695
ErrorKind::Msg(format!(
16871696
"incomprehensible format file name \"{}\"",
16881697
self.format_name

0 commit comments

Comments
 (0)