Skip to content

Commit

Permalink
Update dependencies, switch to once_cell
Browse files Browse the repository at this point in the history
I updated kpathsea because there was a security warning about a
dependency of the current version. While I was messing with
dependencies, I switched things over from `lazy_static!` to
`once_cell`'s `Lazy`, which is likely to be standardized so will be
better to use in the long term.
  • Loading branch information
xymostech committed Nov 29, 2022
1 parent e1d61f1 commit 4c2211c
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 240 deletions.
104 changes: 16 additions & 88 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ name = "interpret"
path = "src/interpret.rs"

[dependencies]
kpathsea = "0.2.2"
lazy_static = "1.3.0"
kpathsea = "0.2.3"
once_cell = "1.16.0"
12 changes: 6 additions & 6 deletions src/box_to_dvi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,16 @@ impl DVIFileWriter {
mod tests {
use super::*;

use once_cell::sync::Lazy;

use crate::boxes::{GlueSetRatioKind, HorizontalBox, VerticalBox};
use crate::dimension::{Dimen, FilDimen, FilKind, SpringDimen, Unit};
use crate::glue::Glue;

lazy_static! {
static ref CMR10: Font = Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
};
}
static CMR10: Lazy<Font> = Lazy::new(|| Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
});

#[test]
fn it_generates_commands_for_chars() {
Expand Down
12 changes: 6 additions & 6 deletions src/boxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,16 @@ impl TeXBox {
mod tests {
use super::*;

use once_cell::sync::Lazy;

use crate::dimension::Unit;
use crate::font::Font;
use crate::glue::Glue;

lazy_static! {
static ref CMR10: Font = Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
};
}
static CMR10: Lazy<Font> = Lazy::new(|| Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
});

#[test]
fn it_parses_to_chars() {
Expand Down
3 changes: 0 additions & 3 deletions src/interpret.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![allow(dead_code)]

#[macro_use]
extern crate lazy_static;

mod dimension;
mod dvi;
mod font;
Expand Down
3 changes: 0 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![deny(clippy::all)]

#[macro_use]
extern crate lazy_static;

mod box_to_dvi;
mod boxes;
mod category;
Expand Down
12 changes: 6 additions & 6 deletions src/parser/boxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,16 @@ impl<'a> Parser<'a> {
mod tests {
use super::*;

use once_cell::sync::Lazy;

use crate::dimension::{Dimen, FilDimen, FilKind, Unit};
use crate::font::Font;
use crate::testing::with_parser;

lazy_static! {
static ref CMR10: Font = Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
};
}
static CMR10: Lazy<Font> = Lazy::new(|| Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
});

#[test]
fn it_parses_boxes_with_characters() {
Expand Down
22 changes: 10 additions & 12 deletions src/parser/horizontal_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,22 @@ impl<'a> Parser<'a> {
mod tests {
use super::*;

use once_cell::sync::Lazy;

use crate::dimension::{FilDimen, FilKind};
use crate::font::Font;
use crate::math_code::MathCode;
use crate::testing::with_parser;

lazy_static! {
static ref CMR10: Font = Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
};
}
static CMR10: Lazy<Font> = Lazy::new(|| Font {
font_name: "cmr10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
});

lazy_static! {
static ref CMMI10: Font = Font {
font_name: "cmmi10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
};
}
static CMMI10: Lazy<Font> = Lazy::new(|| Font {
font_name: "cmmi10".to_string(),
scale: Dimen::from_unit(10.0, Unit::Point),
});

fn assert_parses_to_with_restricted(
lines: &[&str],
Expand Down
Loading

0 comments on commit 4c2211c

Please sign in to comment.