Skip to content

Commit

Permalink
2018 edition: replace extern crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrmaxmeier committed Jun 9, 2019
1 parent 9c91019 commit db65ad2
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 60 deletions.
6 changes: 2 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 4 additions & 6 deletions src/bin/tectonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.

Expand Down
1 change: 1 addition & 0 deletions src/engines/spx2html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/io/itarbundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/io/local_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/io/setup.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
29 changes: 3 additions & 26 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! LaTeX code to a PDF:
//!
//! ```
//! extern crate tectonic;
//! use tectonic;
//!
//! let latex = r#"
//! \documentclass{article}
Expand All @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/status/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

//! A framework for showing status messages to the user.
#[macro_use]
pub mod termcolor;

use std::cmp;
Expand Down
3 changes: 0 additions & 3 deletions tests/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions tests/executable.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 0 additions & 2 deletions tests/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions tests/tex-outputs.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 0 additions & 2 deletions tests/trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 1 addition & 0 deletions xdv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 1 addition & 5 deletions xdv/examples/xdvdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions xdv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit db65ad2

Please sign in to comment.