Skip to content

Commit ab95108

Browse files
authored
Refactor extern crate (daisy#459)
* . * . * .
1 parent ed756ae commit ab95108

14 files changed

Lines changed: 15 additions & 17 deletions

src/braille.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::canonicalize::get_parent;
1414
use std::borrow::Cow;
1515
use std::ops::Range;
1616
use std::sync::LazyLock;
17+
use log::error;
1718

1819
static UEB_PREFIXES: phf::Set<char> = phf_set! {
1920
'⠼', '⠈', '⠘', '⠸', '⠐', '⠨', '⠰', '⠠',
@@ -3033,6 +3034,7 @@ mod tests {
30333034
#[allow(unused_imports)]
30343035
use crate::init_logger;
30353036
use crate::interface::*;
3037+
use log::debug;
30363038

30373039
#[test]
30383040
fn ueb_highlight_24() -> Result<()> { // issue 24

src/canonicalize.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ use crate::chemistry::*;
2121
use unicode_script::Script;
2222
use roman_numerals_rs::RomanNumeral;
2323
use std::sync::LazyLock;
24+
use log::{debug};
25+
use bitflags::bitflags;
2426

2527
// FIX: DECIMAL_SEPARATOR should be set by env, or maybe language
2628
const DECIMAL_SEPARATOR: &str = ".";

src/chemistry.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use regex::Regex;
4343
use crate::xpath_functions::IsBracketed;
4444
use phf::{phf_map, phf_set};
4545
use std::convert::TryInto;
46+
use log::{error};
4647
use std::collections::HashSet;
4748
use std::cmp::Ordering;
4849
use crate::errors::*;

src/definitions.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
//! See the struct [`Definitions`] for the variables that are read in.
2525
#![allow(clippy::needless_return)]
2626

27-
extern crate yaml_rust;
2827
use yaml_rust::yaml::Hash;
2928
use yaml_rust::Yaml;
3029
use crate::errors::*;

src/infer_intent.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::pretty_print::mml_to_string;
1616
use crate::xpath_functions::is_leaf;
1717
use regex::Regex;
1818
use phf::phf_set;
19+
use log::{debug, error, warn};
1920

2021
const IMPLICIT_FUNCTION_NAME: &str = "apply-function";
2122

@@ -619,6 +620,7 @@ fn find_arg<'r, 'c, 's:'c, 'm:'c>(
619620
mod tests {
620621
#[allow(unused_imports)]
621622
use crate::init_logger;
623+
use log::debug;
622624
use sxd_document::parser;
623625

624626

src/interface.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use sxd_document::Package;
1515

1616
use crate::canonicalize::{as_element, name};
1717
use crate::shim_filesystem::{find_all_dirs_shim, find_files_in_dir_that_ends_with_shim};
18+
use log::{debug, error};
1819

1920
use crate::navigate::*;
2021
use crate::pretty_print::mml_to_string;
@@ -30,9 +31,6 @@ fn enable_logs() {
3031
INIT.call_once(||{
3132
#[cfg(target_os = "android")]
3233
{
33-
extern crate log;
34-
extern crate android_logger;
35-
3634
use log::*;
3735
use android_logger::*;
3836

src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ pub mod errors {
2323
pub use anyhow::{anyhow, bail, Error, Result, Context};
2424
}
2525

26-
#[macro_use]
27-
extern crate bitflags;
28-
29-
#[macro_use]
30-
extern crate log;
31-
32-
#[macro_use]
33-
extern crate cfg_if;
34-
35-
3626
pub mod interface;
3727
#[cfg(feature = "include-zip")]
3828
pub use shim_filesystem::ZIPPED_RULE_FILES;

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![allow(clippy::needless_return)]
44

55
use libmathcat::interface::*;
6-
use log::*;
6+
use log::{debug, info};
77
use std::time::Instant;
88

99

src/navigate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::interface::copy_mathml;
1818
use std::time::Instant;
1919
use crate::errors::*;
2020
use phf::phf_set;
21+
use log::{debug};
2122

2223
pub const ID_OFFSET: &str = "data-id-offset";
2324

src/prefs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
use yaml_rust::{Yaml, YamlLoader};
2323
use crate::pretty_print::yaml_to_string;
2424
use crate::tts::TTS;
25-
extern crate dirs;
2625
use std::cell::RefCell;
2726
use std::rc::Rc;
27+
use log::{debug, error, warn};
2828
use std::path::{Path, PathBuf};
2929
use std::sync::LazyLock;
3030
use crate::speech::{as_str_checked, RulesFor, FileAndTime};

0 commit comments

Comments
 (0)