Skip to content

Commit

Permalink
fix warnings: trait objects without an explicit dyn are deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrmaxmeier committed Jun 9, 2019
1 parent a5bd083 commit f6e2fe0
Show file tree
Hide file tree
Showing 21 changed files with 95 additions and 80 deletions.
12 changes: 6 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ impl PersistentConfig {
&self,
url: &str,
only_cached: bool,
status: &mut StatusBackend,
) -> Result<Box<Bundle>> {
status: &mut dyn StatusBackend,
) -> Result<Box<dyn Bundle>> {
let itb = ITarBundle::<HttpITarIoFactory>::new(url);

let mut url2digest_path = app_dir(AppDataType::UserCache, &::APP_INFO, "urls")?;
Expand All @@ -134,8 +134,8 @@ impl PersistentConfig {
pub fn make_local_file_provider(
&self,
file_path: &OsStr,
_status: &mut StatusBackend,
) -> Result<Box<Bundle>> {
_status: &mut dyn StatusBackend,
) -> Result<Box<dyn Bundle>> {
use std::path::Path;

let zip_bundle = ZipBundle::<File>::open(Path::new(file_path))?;
Expand All @@ -146,8 +146,8 @@ impl PersistentConfig {
pub fn default_bundle(
&self,
only_cached: bool,
status: &mut StatusBackend,
) -> Result<Box<Bundle>> {
status: &mut dyn StatusBackend,
) -> Result<Box<dyn Bundle>> {
use hyper::Url;
use std::io;

Expand Down
6 changes: 3 additions & 3 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ pub struct ProcessingSessionBuilder {
pass: PassSetting,
reruns: Option<usize>,
print_stdout: bool,
bundle: Option<Box<Bundle>>,
bundle: Option<Box<dyn Bundle>>,
keep_intermediates: bool,
keep_logs: bool,
synctex: bool,
Expand Down Expand Up @@ -408,7 +408,7 @@ impl ProcessingSessionBuilder {

/// Sets the bundle, which the various engines will use for finding style files, font files,
/// etc.
pub fn bundle(&mut self, b: Box<Bundle>) -> &mut Self {
pub fn bundle(&mut self, b: Box<dyn Bundle>) -> &mut Self {
self.bundle = Some(b);
self
}
Expand All @@ -432,7 +432,7 @@ impl ProcessingSessionBuilder {
}

/// Creates a `ProcessingSession`.
pub fn create(self, status: &mut StatusBackend) -> Result<ProcessingSession> {
pub fn create(self, status: &mut dyn StatusBackend) -> Result<ProcessingSession> {
let mut io = IoSetupBuilder::default();
io.bundle(self.bundle.expect("a bundle must be specified"))
.use_genuine_stdout(self.print_stdout);
Expand Down
4 changes: 2 additions & 2 deletions src/engines/bibtex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ impl BibtexEngine {
pub fn process(
&mut self,
io: &mut IoStack,
events: &mut IoEventBackend,
status: &mut StatusBackend,
events: &mut dyn IoEventBackend,
status: &mut dyn StatusBackend,
aux: &str,
) -> Result<TexResult> {
let _guard = super::ENGINE_LOCK.lock().unwrap(); // until we're thread-safe ...
Expand Down
8 changes: 4 additions & 4 deletions src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ lazy_static! {
struct ExecutionState<'a, I: 'a + IoProvider> {
io: &'a mut I,
events: &'a mut IoEventBackend,
status: &'a mut StatusBackend,
events: &'a mut dyn IoEventBackend,
status: &'a mut dyn StatusBackend,
#[allow(clippy::vec_box)]
input_handles: Vec<Box<InputHandle>>,
#[allow(clippy::vec_box)]
Expand All @@ -134,8 +134,8 @@ struct ExecutionState<'a, I: 'a + IoProvider> {
impl<'a, I: 'a + IoProvider> ExecutionState<'a, I> {
pub fn new(
io: &'a mut I,
events: &'a mut IoEventBackend,
status: &'a mut StatusBackend,
events: &'a mut dyn IoEventBackend,
status: &'a mut dyn StatusBackend,
) -> ExecutionState<'a, I> {
ExecutionState {
io,
Expand Down
12 changes: 6 additions & 6 deletions src/engines/spx2html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ impl Spx2HtmlEngine {
pub fn process(
&mut self,
io: &mut IoStack,
events: &mut IoEventBackend,
status: &mut StatusBackend,
events: &mut dyn IoEventBackend,
status: &mut dyn StatusBackend,
spx: &str,
) -> Result<()> {
let mut input = io.input_open_name(OsStr::new(spx), status).must_exist()?;
Expand Down Expand Up @@ -61,8 +61,8 @@ impl Spx2HtmlEngine {
struct State<'a, 'b: 'a> {
outname: String,
io: &'a mut IoStack<'b>,
events: &'a mut IoEventBackend,
status: &'a mut StatusBackend,
events: &'a mut dyn IoEventBackend,
status: &'a mut dyn StatusBackend,
cur_output: Option<OutputHandle>,
warned_lost_chars: bool,
buf: Vec<u8>,
Expand All @@ -72,8 +72,8 @@ impl<'a, 'b: 'a> State<'a, 'b> {
pub fn new(
outname: String,
io: &'a mut IoStack<'b>,
events: &'a mut IoEventBackend,
status: &'a mut StatusBackend,
events: &'a mut dyn IoEventBackend,
status: &'a mut dyn StatusBackend,
) -> Self {
Self {
outname,
Expand Down
4 changes: 2 additions & 2 deletions src/engines/tex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ impl TexEngine {
pub fn process(
&mut self,
io: &mut IoStack,
events: &mut IoEventBackend,
status: &mut StatusBackend,
events: &mut dyn IoEventBackend,
status: &mut dyn StatusBackend,
format_file_name: &str,
input_file_name: &str,
) -> Result<TexResult> {
Expand Down
4 changes: 2 additions & 2 deletions src/engines/xdvipdfmx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ impl XdvipdfmxEngine {
pub fn process(
&mut self,
io: &mut IoStack,
events: &mut IoEventBackend,
status: &mut StatusBackend,
events: &mut dyn IoEventBackend,
status: &mut dyn StatusBackend,
dvi: &str,
pdf: &str,
) -> Result<i32> {
Expand Down
4 changes: 2 additions & 2 deletions src/io/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl FilesystemPrimaryInputIo {
}

impl IoProvider for FilesystemPrimaryInputIo {
fn input_open_primary(&mut self, _status: &mut StatusBackend) -> OpenResult<InputHandle> {
fn input_open_primary(&mut self, _status: &mut dyn StatusBackend) -> OpenResult<InputHandle> {
let f = match try_open_file(&self.path) {
OpenResult::Ok(f) => f,
OpenResult::NotAvailable => return OpenResult::NotAvailable,
Expand Down Expand Up @@ -121,7 +121,7 @@ impl IoProvider for FilesystemIo {
fn input_open_name(
&mut self,
name: &OsStr,
_status: &mut StatusBackend,
_status: &mut dyn StatusBackend,
) -> OpenResult<InputHandle> {
let path = match self.construct_path(name) {
Ok(p) => p,
Expand Down
9 changes: 7 additions & 2 deletions src/io/format_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl IoProvider for FormatCache {
fn input_open_format(
&mut self,
name: &OsStr,
_status: &mut StatusBackend,
_status: &mut dyn StatusBackend,
) -> OpenResult<InputHandle> {
let path = match self.path_for_format(name) {
Ok(p) => p,
Expand All @@ -91,7 +91,12 @@ impl IoProvider for FormatCache {
))
}

fn write_format(&mut self, name: &str, data: &[u8], _status: &mut StatusBackend) -> Result<()> {
fn write_format(
&mut self,
name: &str,
data: &[u8],
_status: &mut dyn StatusBackend,
) -> Result<()> {
let final_path = self.path_for_format(OsStr::new(name))?;
let mut temp_dest = tempfile::Builder::new()
.prefix("format_")
Expand Down
12 changes: 6 additions & 6 deletions src/io/itarbundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ pub trait ITarIoFactory {
type IndexReader: Read;
type DataReader: RangeRead;

fn get_index(&mut self, status: &mut StatusBackend) -> Result<Self::IndexReader>;
fn get_index(&mut self, status: &mut dyn StatusBackend) -> Result<Self::IndexReader>;
fn get_data(&self) -> Result<Self::DataReader>;
fn report_fetch(&self, name: &OsStr, status: &mut StatusBackend);
fn report_fetch(&self, name: &OsStr, status: &mut dyn StatusBackend);
}

struct FileInfo {
Expand All @@ -94,7 +94,7 @@ impl<F: ITarIoFactory> ITarBundle<F> {
}
}

fn ensure_loaded(&mut self, status: &mut StatusBackend) -> Result<()> {
fn ensure_loaded(&mut self, status: &mut dyn StatusBackend) -> Result<()> {
if self.data.is_some() {
return Ok(());
}
Expand Down Expand Up @@ -132,7 +132,7 @@ impl<F: ITarIoFactory> IoProvider for ITarBundle<F> {
fn input_open_name(
&mut self,
name: &OsStr,
status: &mut StatusBackend,
status: &mut dyn StatusBackend,
) -> OpenResult<InputHandle> {
if let Err(e) = self.ensure_loaded(status) {
return OpenResult::Err(e);
Expand Down Expand Up @@ -214,7 +214,7 @@ impl ITarIoFactory for HttpITarIoFactory {
type IndexReader = GzDecoder<Response>;
type DataReader = HttpRangeReader;

fn get_index(&mut self, status: &mut StatusBackend) -> Result<GzDecoder<Response>> {
fn get_index(&mut self, status: &mut dyn StatusBackend) -> Result<GzDecoder<Response>> {
tt_note!(status, "indexing {}", self.url);

// First, we actually do a HEAD request on the URL for the data file.
Expand Down Expand Up @@ -275,7 +275,7 @@ impl ITarIoFactory for HttpITarIoFactory {
Ok(HttpRangeReader::new(&self.url))
}

fn report_fetch(&self, name: &OsStr, status: &mut StatusBackend) {
fn report_fetch(&self, name: &OsStr, status: &mut dyn StatusBackend) {
tt_note!(status, "downloading {}", name.to_string_lossy());
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/io/local_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<B: Bundle> LocalCache<B> {
manifest_base: &Path,
data: &Path,
only_cached: bool,
status: &mut StatusBackend,
status: &mut dyn StatusBackend,
) -> Result<LocalCache<B>> {
// If the `digest` file exists, we assume that it is valid; this is
// *essential* so that we can use a URL as our default IoProvider
Expand Down Expand Up @@ -203,7 +203,7 @@ impl<B: Bundle> LocalCache<B> {
/// error out but set things up so that things should succeed if the
/// program is re-run. Exactly the lame TeX user experience that I've been
/// trying to avoid!
fn check_digest(&mut self, status: &mut StatusBackend) -> Result<()> {
fn check_digest(&mut self, status: &mut dyn StatusBackend) -> Result<()> {
if self.checked_digest {
return Ok(());
}
Expand Down Expand Up @@ -250,7 +250,11 @@ impl<B: Bundle> LocalCache<B> {
Ok(())
}

fn path_for_name(&mut self, name: &OsStr, status: &mut StatusBackend) -> OpenResult<PathBuf> {
fn path_for_name(
&mut self,
name: &OsStr,
status: &mut dyn StatusBackend,
) -> OpenResult<PathBuf> {
if let Some(info) = self.contents.get(name) {
return match info.digest {
None => OpenResult::NotAvailable,
Expand Down Expand Up @@ -376,7 +380,7 @@ impl<B: Bundle> IoProvider for LocalCache<B> {
fn input_open_name(
&mut self,
name: &OsStr,
status: &mut StatusBackend,
status: &mut dyn StatusBackend,
) -> OpenResult<InputHandle> {
let path = match self.path_for_name(name, status) {
OpenResult::Ok(p) => p,
Expand All @@ -398,7 +402,7 @@ impl<B: Bundle> IoProvider for LocalCache<B> {
}

impl<B: Bundle> Bundle for LocalCache<B> {
fn get_digest(&mut self, _status: &mut StatusBackend) -> Result<DigestData> {
fn get_digest(&mut self, _status: &mut dyn StatusBackend) -> Result<DigestData> {
Ok(self.cached_digest)
}
}
2 changes: 1 addition & 1 deletion src/io/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl IoProvider for MemoryIo {
fn input_open_name(
&mut self,
name: &OsStr,
_status: &mut StatusBackend,
_status: &mut dyn StatusBackend,
) -> OpenResult<InputHandle> {
if name.is_empty() {
return OpenResult::NotAvailable;
Expand Down
Loading

0 comments on commit f6e2fe0

Please sign in to comment.