From aa80dc7e2b0deba2dd9c3f7b8d0eddd983b4ab20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Gro=C3=9F?= Date: Mon, 12 Jan 2026 14:40:24 +0100 Subject: [PATCH 1/3] . --- src/braille.rs | 1 + src/canonicalize.rs | 2 ++ src/chemistry.rs | 1 + src/definitions.rs | 1 - src/infer_intent.rs | 1 + src/interface.rs | 4 +--- src/lib.rs | 16 +++++++--------- src/navigate.rs | 1 + src/prefs.rs | 2 +- src/pretty_print.rs | 1 - src/shim_filesystem.rs | 2 ++ src/speech.rs | 1 + src/xpath_functions.rs | 1 + 13 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/braille.rs b/src/braille.rs index b7f9d92f..1ccf7c7e 100644 --- a/src/braille.rs +++ b/src/braille.rs @@ -14,6 +14,7 @@ use crate::canonicalize::get_parent; use std::borrow::Cow; use std::ops::Range; use std::sync::LazyLock; +use log::{error, debug}; static UEB_PREFIXES: phf::Set = phf_set! { '⠼', '⠈', '⠘', '⠸', '⠐', '⠨', '⠰', '⠠', diff --git a/src/canonicalize.rs b/src/canonicalize.rs index 6b661e32..b1f69720 100644 --- a/src/canonicalize.rs +++ b/src/canonicalize.rs @@ -21,6 +21,8 @@ use crate::chemistry::*; use unicode_script::Script; use roman_numerals_rs::RomanNumeral; use std::sync::LazyLock; +use log::{debug}; +use bitflags::bitflags; // FIX: DECIMAL_SEPARATOR should be set by env, or maybe language const DECIMAL_SEPARATOR: &str = "."; diff --git a/src/chemistry.rs b/src/chemistry.rs index d1d49a19..5219f548 100644 --- a/src/chemistry.rs +++ b/src/chemistry.rs @@ -43,6 +43,7 @@ use regex::Regex; use crate::xpath_functions::IsBracketed; use phf::{phf_map, phf_set}; use std::convert::TryInto; +use log::{error}; use std::collections::HashSet; use std::cmp::Ordering; use crate::errors::*; diff --git a/src/definitions.rs b/src/definitions.rs index 8ca8d694..227383c7 100644 --- a/src/definitions.rs +++ b/src/definitions.rs @@ -24,7 +24,6 @@ //! See the struct [`Definitions`] for the variables that are read in. #![allow(clippy::needless_return)] -extern crate yaml_rust; use yaml_rust::yaml::Hash; use yaml_rust::Yaml; use crate::errors::*; diff --git a/src/infer_intent.rs b/src/infer_intent.rs index 2b521d22..5d259fd1 100644 --- a/src/infer_intent.rs +++ b/src/infer_intent.rs @@ -16,6 +16,7 @@ use crate::pretty_print::mml_to_string; use crate::xpath_functions::is_leaf; use regex::Regex; use phf::phf_set; +use log::{debug, error, warn}; const IMPLICIT_FUNCTION_NAME: &str = "apply-function"; diff --git a/src/interface.rs b/src/interface.rs index 077e1e6c..c8b24f25 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -15,6 +15,7 @@ use sxd_document::Package; use crate::canonicalize::{as_element, name}; use crate::shim_filesystem::{find_all_dirs_shim, find_files_in_dir_that_ends_with_shim}; +use log::{debug, error}; use crate::navigate::*; use crate::pretty_print::mml_to_string; @@ -30,9 +31,6 @@ fn enable_logs() { INIT.call_once(||{ #[cfg(target_os = "android")] { - extern crate log; - extern crate android_logger; - use log::*; use android_logger::*; diff --git a/src/lib.rs b/src/lib.rs index 7397c4a2..5d3876eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,15 +23,13 @@ pub mod errors { pub use anyhow::{anyhow, bail, Error, Result, Context}; } -#[macro_use] -extern crate bitflags; - -#[macro_use] -extern crate log; - -#[macro_use] -extern crate cfg_if; - +// Import macros for use throughout the crate +#[allow(unused_imports)] +use log::{debug, error, info, trace, warn}; +#[allow(unused_imports)] +use cfg_if::cfg_if; +#[allow(unused_imports)] +use bitflags::bitflags; pub mod interface; #[cfg(feature = "include-zip")] diff --git a/src/navigate.rs b/src/navigate.rs index 593b81f3..c7af7de6 100644 --- a/src/navigate.rs +++ b/src/navigate.rs @@ -18,6 +18,7 @@ use crate::interface::copy_mathml; use std::time::Instant; use crate::errors::*; use phf::phf_set; +use log::{debug}; pub const ID_OFFSET: &str = "data-id-offset"; diff --git a/src/prefs.rs b/src/prefs.rs index be2df771..a8c5d681 100644 --- a/src/prefs.rs +++ b/src/prefs.rs @@ -22,9 +22,9 @@ use yaml_rust::{Yaml, YamlLoader}; use crate::pretty_print::yaml_to_string; use crate::tts::TTS; -extern crate dirs; use std::cell::RefCell; use std::rc::Rc; +use log::{debug, error, warn}; use std::path::{Path, PathBuf}; use std::sync::LazyLock; use crate::speech::{as_str_checked, RulesFor, FileAndTime}; diff --git a/src/pretty_print.rs b/src/pretty_print.rs index e409fa3f..625283f8 100644 --- a/src/pretty_print.rs +++ b/src/pretty_print.rs @@ -167,7 +167,6 @@ fn is_complex(v: &Yaml) -> bool { use std::error::Error; use std::fmt::{self, Display}; -extern crate yaml_rust; use yaml_rust::{Yaml, yaml::Hash}; //use crate::yaml::{Hash, Yaml}; diff --git a/src/shim_filesystem.rs b/src/shim_filesystem.rs index 3c7f36f8..6726d03a 100644 --- a/src/shim_filesystem.rs +++ b/src/shim_filesystem.rs @@ -4,6 +4,8 @@ use std::path::{Path, PathBuf}; use crate::errors::*; +use cfg_if::cfg_if; +use log::{debug}; // The zipped files are needed by WASM builds. diff --git a/src/speech.rs b/src/speech.rs index 3c03cc3d..845dd8e3 100644 --- a/src/speech.rs +++ b/src/speech.rs @@ -27,6 +27,7 @@ use std::rc::Rc; use crate::shim_filesystem::{read_to_string_shim, canonicalize_shim}; use crate::canonicalize::{as_element, create_mathml_element, set_mathml_name, name, MATHML_FROM_NAME_ATTR}; use regex::Regex; +use log::{debug, error, info}; pub const NAV_NODE_SPEECH_NOT_FOUND: &str = "NAV_NODE_NOT_FOUND"; diff --git a/src/xpath_functions.rs b/src/xpath_functions.rs index e10e548c..e08329af 100644 --- a/src/xpath_functions.rs +++ b/src/xpath_functions.rs @@ -23,6 +23,7 @@ use crate::definitions::{Definitions, SPEECH_DEFINITIONS, BRAILLE_DEFINITIONS}; use regex::Regex; use crate::pretty_print::mml_to_string; use std::cell::{Ref, RefCell}; +use log::{debug, error, warn}; use std::sync::LazyLock; use std::thread::LocalKey; use phf::phf_set; From 37879ffabd19b1db3d400d8d3a7eacb6d15d0d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Gro=C3=9F?= Date: Mon, 12 Jan 2026 14:47:22 +0100 Subject: [PATCH 2/3] . --- src/braille.rs | 3 ++- src/infer_intent.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/braille.rs b/src/braille.rs index 1ccf7c7e..f259ca0b 100644 --- a/src/braille.rs +++ b/src/braille.rs @@ -14,7 +14,7 @@ use crate::canonicalize::get_parent; use std::borrow::Cow; use std::ops::Range; use std::sync::LazyLock; -use log::{error, debug}; +use log::error; static UEB_PREFIXES: phf::Set = phf_set! { '⠼', '⠈', '⠘', '⠸', '⠐', '⠨', '⠰', '⠠', @@ -3034,6 +3034,7 @@ mod tests { #[allow(unused_imports)] use crate::init_logger; use crate::interface::*; + use log::debug; #[test] fn ueb_highlight_24() -> Result<()> { // issue 24 diff --git a/src/infer_intent.rs b/src/infer_intent.rs index 5d259fd1..8444fd1e 100644 --- a/src/infer_intent.rs +++ b/src/infer_intent.rs @@ -620,6 +620,7 @@ fn find_arg<'r, 'c, 's:'c, 'm:'c>( mod tests { #[allow(unused_imports)] use crate::init_logger; + use log::debug; use sxd_document::parser; From 6423198420725ef4074174001703336529e94283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Gro=C3=9F?= Date: Mon, 12 Jan 2026 14:54:11 +0100 Subject: [PATCH 3/3] . --- src/lib.rs | 8 -------- src/main.rs | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5d3876eb..4b05c57b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,14 +23,6 @@ pub mod errors { pub use anyhow::{anyhow, bail, Error, Result, Context}; } -// Import macros for use throughout the crate -#[allow(unused_imports)] -use log::{debug, error, info, trace, warn}; -#[allow(unused_imports)] -use cfg_if::cfg_if; -#[allow(unused_imports)] -use bitflags::bitflags; - pub mod interface; #[cfg(feature = "include-zip")] pub use shim_filesystem::ZIPPED_RULE_FILES; diff --git a/src/main.rs b/src/main.rs index 695ae82b..926805d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ #![allow(clippy::needless_return)] use libmathcat::interface::*; -use log::*; +use log::{debug, info}; use std::time::Instant;