diff --git a/build.rs b/build.rs index a14c2c9227..08ee61f850 100644 --- a/build.rs +++ b/build.rs @@ -4,10 +4,8 @@ // // TODO: this surely needs to become much smarter and more flexible. -extern crate cc; -extern crate pkg_config; -extern crate regex; -extern crate sha2; +use cc; +use pkg_config; use std::path::PathBuf; diff --git a/src/bin/tectonic.rs b/src/bin/tectonic.rs index ed6130505c..1a17c97959 100644 --- a/src/bin/tectonic.rs +++ b/src/bin/tectonic.rs @@ -2,12 +2,8 @@ // Copyright 2016-2018 the Tectonic Project // Licensed under the MIT License. -extern crate aho_corasick; -#[macro_use] -extern crate clap; -#[macro_use] -extern crate tectonic; -extern crate termcolor; +use clap::crate_version; +use tectonic; use clap::{App, Arg, ArgMatches}; use std::fs::File; @@ -21,6 +17,8 @@ use tectonic::io::zipbundle::ZipBundle; use tectonic::status::termcolor::TermcolorStatusBackend; use tectonic::status::{ChatterLevel, StatusBackend}; +use tectonic::{ctry, errmsg, tt_error, tt_error_styled, tt_note}; + fn inner( args: ArgMatches, config: PersistentConfig, diff --git a/src/driver.rs b/src/driver.rs index 881c529093..69f6baba53 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -24,6 +24,7 @@ use crate::engines::IoEventBackend; use crate::errors::{ErrorKind, Result, ResultExt}; use crate::io::{Bundle, InputOrigin, IoProvider, IoSetup, IoSetupBuilder, OpenResult}; use crate::status::StatusBackend; +use crate::{ctry, errmsg, tt_error, tt_note, tt_warning}; use crate::{BibtexEngine, Spx2HtmlEngine, TexEngine, TexResult, XdvipdfmxEngine}; /// Different patterns with which files may have been accessed by the diff --git a/src/engines/mod.rs b/src/engines/mod.rs index 67df569b6c..7f020b7c95 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -14,6 +14,7 @@ use flate2::read::GzDecoder; use flate2::{Compression, GzBuilder}; +use lazy_static::lazy_static; use libc; use md5::{Digest, Md5}; use std::borrow::Cow; @@ -27,6 +28,7 @@ use crate::digest::DigestData; use crate::errors::{Error, ErrorKind, Result}; use crate::io::{InputFeatures, InputHandle, InputOrigin, IoProvider, OpenResult, OutputHandle}; use crate::status::StatusBackend; +use crate::{tt_error, tt_warning}; // Public sub-modules and reexports. diff --git a/src/engines/spx2html.rs b/src/engines/spx2html.rs index 14d81fe3d7..cd1c84e0eb 100644 --- a/src/engines/spx2html.rs +++ b/src/engines/spx2html.rs @@ -13,6 +13,7 @@ use super::IoEventBackend; use crate::errors::{Error, Result}; use crate::io::{IoProvider, IoStack, OpenResult, OutputHandle}; use crate::status::StatusBackend; +use crate::{errmsg, tt_warning}; #[derive(Default)] pub struct Spx2HtmlEngine {} diff --git a/src/errors.rs b/src/errors.rs index 001c77a07d..54168c2308 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -11,6 +11,7 @@ #![allow(deprecated)] use app_dirs; +use error_chain::error_chain; use hyper; use std::io::Write; use std::result::Result as StdResult; diff --git a/src/io/itarbundle.rs b/src/io/itarbundle.rs index 9bc7113294..7d622432d2 100644 --- a/src/io/itarbundle.rs +++ b/src/io/itarbundle.rs @@ -14,6 +14,7 @@ use std::io::{BufRead, BufReader, Cursor, Read}; use super::{create_hyper_client, Bundle, InputHandle, InputOrigin, IoProvider, OpenResult}; use crate::errors::{Error, ErrorKind, Result, ResultExt}; use crate::status::StatusBackend; +use crate::{tt_note, tt_warning}; const MAX_HTTP_ATTEMPTS: usize = 4; diff --git a/src/io/local_cache.rs b/src/io/local_cache.rs index ddef439b17..b1f1e2da46 100644 --- a/src/io/local_cache.rs +++ b/src/io/local_cache.rs @@ -16,6 +16,7 @@ use super::{try_open_file, Bundle, InputHandle, InputOrigin, IoProvider, OpenRes use crate::digest::{self, Digest, DigestData}; use crate::errors::{ErrorKind, Result}; use crate::status::StatusBackend; +use crate::{ctry, tt_warning}; struct LocalCacheItem { _length: u64, diff --git a/src/io/mod.rs b/src/io/mod.rs index 6967634e5c..53784eeb79 100644 --- a/src/io/mod.rs +++ b/src/io/mod.rs @@ -15,6 +15,7 @@ use std::io::{self, Cursor, Read, Seek, SeekFrom, Write}; use std::path::Path; use std::str::FromStr; +use crate::ctry; use crate::digest::{self, Digest, DigestData}; use crate::errors::{Error, ErrorKind, Result}; use crate::status::StatusBackend; diff --git a/src/io/setup.rs b/src/io/setup.rs index c0643a660c..bd86364231 100644 --- a/src/io/setup.rs +++ b/src/io/setup.rs @@ -1,6 +1,7 @@ use std::collections::HashSet; use std::path::{Path, PathBuf}; +use crate::ctry; use crate::errors::Result; use crate::io::format_cache::FormatCache; use crate::io::stdstreams::BufferedPrimaryIo; diff --git a/src/lib.rs b/src/lib.rs index 717f084e5e..11a0991f18 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ //! LaTeX code to a PDF: //! //! ``` -//! extern crate tectonic; +//! use tectonic; //! //! let latex = r#" //! \documentclass{article} @@ -48,36 +48,13 @@ //! The [`driver`] module provides a high-level interface for driving the //! engines in more realistic circumstances. -extern crate aho_corasick; -extern crate app_dirs; -#[macro_use] -extern crate error_chain; -extern crate flate2; -extern crate fs2; -extern crate hyper; -extern crate hyper_native_tls; -#[macro_use] -extern crate lazy_static; -extern crate libc; -extern crate md5; -#[cfg(feature = "serde")] -extern crate serde; -extern crate sha2; -extern crate tectonic_xdv; -extern crate tempfile; -extern crate termcolor; -extern crate toml; -extern crate zip; - -#[macro_use] -pub mod status; -#[macro_use] -pub mod errors; pub mod config; pub mod digest; pub mod driver; pub mod engines; +pub mod errors; pub mod io; +pub mod status; // Note: this module is intentionally *not* gated by #[cfg(test)] -- see its // docstring for details. diff --git a/src/status/mod.rs b/src/status/mod.rs index 25fc5b6156..5c54e9ab58 100644 --- a/src/status/mod.rs +++ b/src/status/mod.rs @@ -4,7 +4,6 @@ //! A framework for showing status messages to the user. -#[macro_use] pub mod termcolor; use std::cmp; diff --git a/tests/driver.rs b/tests/driver.rs index aac528bc19..b89402cdf7 100644 --- a/tests/driver.rs +++ b/tests/driver.rs @@ -8,9 +8,6 @@ //! ProcessingSessionBuilder will need to learn how to tell `xdvipdfmx` to //! enable the reproducibility options used in the `tex-outputs` test rig. -extern crate tectonic; -extern crate tempfile; - use tectonic::config::PersistentConfig; use tectonic::driver::ProcessingSessionBuilder; use tectonic::status::termcolor::TermcolorStatusBackend; diff --git a/tests/executable.rs b/tests/executable.rs index 879e3f3bc0..2748cfb995 100644 --- a/tests/executable.rs +++ b/tests/executable.rs @@ -1,10 +1,7 @@ // Copyright 2016-2018 the Tectonic Project // Licensed under the MIT License. -#[macro_use] -extern crate lazy_static; -extern crate tectonic; -extern crate tempfile; +use lazy_static::lazy_static; use std::env; use std::fs::{self, File}; diff --git a/tests/formats.rs b/tests/formats.rs index 31cabd4f10..8480096e60 100644 --- a/tests/formats.rs +++ b/tests/formats.rs @@ -14,8 +14,6 @@ /// Temporarily set the constant DEBUG to true to dump out the generated files /// to disk, which may be helpful in debugging. There is probably a less gross /// way to implement that option. -extern crate tectonic; - use std::collections::{HashMap, HashSet}; use std::ffi::{OsStr, OsString}; use std::str::FromStr; diff --git a/tests/tex-outputs.rs b/tests/tex-outputs.rs index 6abe0ffdca..cdf103c465 100644 --- a/tests/tex-outputs.rs +++ b/tests/tex-outputs.rs @@ -1,8 +1,6 @@ // Copyright 2016-2018 the Tectonic Project // Licensed under the MIT License. -extern crate tectonic; - use std::collections::HashSet; use std::env; use std::path::Path; diff --git a/tests/trip.rs b/tests/trip.rs index 9d8e6e0129..ca06e883de 100644 --- a/tests/trip.rs +++ b/tests/trip.rs @@ -13,8 +13,6 @@ /// multithreading can be disabled by setting the RUST_TEST_THREADS environment /// variable to "1", but that's an annoying solution. So, we use a global mutex /// to achieve the same effect. Classy. -extern crate tectonic; - use std::ffi::OsStr; use tectonic::engines::NoopIoEventBackend; diff --git a/tests/util/mod.rs b/tests/util/mod.rs index 940edae380..a7c3761747 100644 --- a/tests/util/mod.rs +++ b/tests/util/mod.rs @@ -10,9 +10,6 @@ // using this testing setup... #![allow(dead_code)] -extern crate flate2; -extern crate tectonic; -extern crate tempfile; use self::flate2::read::GzDecoder; use std::collections::{HashMap, HashSet}; diff --git a/xdv/Cargo.toml b/xdv/Cargo.toml index 492dff4efe..ec6e7b05ee 100644 --- a/xdv/Cargo.toml +++ b/xdv/Cargo.toml @@ -13,6 +13,7 @@ documentation = "https://docs.rs/tectonic" repository = "https://github.com/tectonic-typesetting/tectonic/" readme = "README.md" license = "MIT" +edition = "2018" [dependencies] byteorder = "^1.3" diff --git a/xdv/examples/xdvdump.rs b/xdv/examples/xdvdump.rs index d2da8261cd..ced31dc9ad 100644 --- a/xdv/examples/xdvdump.rs +++ b/xdv/examples/xdvdump.rs @@ -3,11 +3,7 @@ //! Parse an XDV/SPX file and dump some stats about its contents. -#[macro_use] -extern crate clap; -extern crate tectonic_xdv; - -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fmt::{Display, Error as FmtError, Formatter}; use std::fs::File; use std::io; diff --git a/xdv/src/lib.rs b/xdv/src/lib.rs index b29449db27..3bef176a98 100644 --- a/xdv/src/lib.rs +++ b/xdv/src/lib.rs @@ -13,8 +13,6 @@ //! expresses output that is not paginated for print — this is what Tectonic //! uses to produce its HTML output. -extern crate byteorder; - use byteorder::{BigEndian, ByteOrder}; use std::error; use std::fmt::{Debug, Display, Error as FmtError, Formatter};